Yard Bird
“Sing sweet documentation in my ear.”
Description
Yardbird is a YARD plugin that allows you, the developer, to customize your documentation parsing system.
Resources
Check It Out
Sound like a chore? Until you see it allows you do this:
# .yard/example.bird
When /^Returns\s+(.*?)$/ do |matchdata, comment|
create_tag(:return, matchdata[1])
end
Now, whenever your documentation starts with ‘Returns ’, the remainder of the line will be added to YARD as a :return tag.
Now we can get even crazier a create a simplified implementation of Tomdoc.
require 'tomdoc/tomdoc'
When /\A.*?\Z/m do |matchdata, comment|
tomdoc = TomDoc::TomDoc.new(comment)
tomdoc.examples.each {|ex| create_tag(:example, "\n" + ex) }
tomdoc.args.each {|arg| create_tag(:param, "#{arg.name} #{arg.description}") }
tomdoc.raises.each {|r| create_tag(:raise, r.sub(/\ARaises\s+/, '')) }
tomdoc.returns.each {|r| create_tag(:return, r.sub(/\AReturns\s+/, '')) }
tomdoc.description
end
Now it’s your turn. You have the power*, Yard Bird will singe Your song. And YARD will happily spit it out all pretty.
License
(MIT License)
Copyright © 2011 Rubyworks
See NOTICE.rdoc file for more details.