An open API service indexing awesome lists of open source software.

https://github.com/rubyworks/yard-bird

Custom YARD Documentation
https://github.com/rubyworks/yard-bird

Last synced: 6 months ago
JSON representation

Custom YARD Documentation

Awesome Lists containing this project

README

          

= 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

* {Homepage}[http://rubyworks.github.com]
* {Source Code}[http://github.com/rubyworks]
* {Mainling List}[http://groups.google.com/group/rubyworks-mailinglist]
* {}[http://travis-ci.org/rubyworks/yard-bird]

== 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}[http://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 (c) 2011 Rubyworks

See NOTICE.rdoc file for more details.