Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (46 sloc) 2.31 KB

yard-rails

NOTE: THIS PROJECT HAS BEEN ABANDONED.

You can do pretty much everything you'd want to do as far as Rails attributes, validation, class attributes, and so on, using the new powerful "directive" methods that were implemented into YARD 0.8. For example, define an attr_accessible attribute with:

# @!attribute title
#   @return [String] the title of this document

Define a cattr_reader attribute with:

# @!attribute [r] facets
#   @!scope class
#
#   Faceted browsing information that was returned by the last search

Since each of these @!attribute directives open up a full, standard YARD documentation block for the attribute, you can specify any validations (for example) like this:

# @!attribute title
#   @raise [RecordInvalid] if the title is missing (validates :presence)
#   @return [String] the title of this document

Given the power (and transparency, as opposed to the opacity of plugin methods) of these new documentation methods, I don't see any reason to go out of my way to maintain this gem anymore. If somebody would like to pick up where I left off, feel free to fork and go to town.


Description

A YARD plugin for parsing the custom Ruby syntax added by Rails.

If you are using YARD >= 0.6, you will need to enable the plugin manually. Add the following line to your .yardopts file:

--plugin yard-rails

For older versions of YARD, all plugins are loaded automatically.

Features

Parses the following statements:

attr_accessible :attr

attr_protected :attr

cattr_reader :attr

cattr_writer :attr

cattr_accessor :attr

mattr_reader :attr

mattr_writer :attr

mattr_accessor :attr

If you know of more Rails-specific DSL that should be included in this plugin, feel free to create an issue here on GitHub, and I'll be happy to include it.

Requirements

Install

$ sudo gem install yard-rails

License

See LICENSE.txt for license information.

Thanks

Thanks to Postmodern's yard-dm gem, which provided much of the framework I've used to package yard-rails.