Announcing The Longest YARD: 0.5.0
YARD 0.5.0 (“The Longest”) was just released today. It features a bunch of new things, but some of the most awesome are:
- Support for documenting native Ruby C code
- Incremental file parsing and HTML generation
- Improved yri tool with support for linking gems
Support for Documenting Native Ruby C Code
This one was certainly a long time coming. YARD has always planned to support native Ruby code. This was probably the last "big" feature that RDoc could do and YARD could not. Now, YARD can.
The best part of this feature is that YARD can now parse Ruby’s core codebase and the stdlib, meaning yardoc.org can now host Ruby-core docs. And it now does: http://yardoc.org/docs/ruby-core. The stdlib will be added soon.
Incremental file parsing and HTML generation
One annoying thing about documenting code with YARD for larger projects is the time it takes to generate HTML. This makes the documentation development cycle slow for previewing small documentation changes. YARD 0.5.0 introduces incremental parsing and HTML generation to parse and generate HTML for only the files that were modified since the last running of yardoc, which makes for super-fast previews. To use the incremental parsing feature, simply add -c or --use-cache and YARD will use the available .yardoc cache.
$ yardoc --use-cache
Improved yri tool with support for linking gems
The yri tool that bundled with YARD prior to this release only worked for the .yardoc file in the local directory. In YARD 0.5.0, yri will now perform a lookup on all installed gems on your system. To use this, you’ll first need to build the .yardoc files for your gems, and you can do this with yardoc --build-gems. After that, you can use yri as normal:
$ yri JSON#load
$ gem install yard