YARD 0.7.0 Released!
Today I released YARD 0.7.0, you can install it with:
$ gem install yard
As always, documentation can be found on the site at http://yardoc.org
The Good Stuff: Macros
The main feature of YARD 0.7.0 is the automatic detection of documented DSL methods and macros. Macros can be used to DRY up repetitive documentation by
“copying” docstrings from other objects. There is a fair bit of documentation
on this new functionality in the Getting Started Guide. In
short, YARD can now automatically document the following example without
any extra plugins or code:
class Post
# @return [String] the title of the post
property :title
end
YARD can also use macros to expand arguments in a DSL method call to simplify
and DRY up the documentation process:
class Post
# @macro defaultattr
# @return [Dog] the $1 type. Defaults to $2
attr_accessor_with_default :dog, 'Black Lab'
end
The above return tag will expand to “the dog type. Defaults to Black Lab”
There’s plenty of other cool stuff in YARD, but you can read about it all in
the What’s New docs on the YARD site!