I use YARD to document my project. YARD document attributes created using
attr_accessor :some_attribute
in a separate section “Summary of Instance Attributes”. I now have a different attribute, but with a custom installer and getter
def some_other_attribute ... end def some_other_attribute= value ... end
so basically my question is: how can I get a YARD to document this setter / getter pair, as attr_accessorin the previous case, and list it some_other_attributein the “Instance Attributes Summary”?
attr_accessor
some_other_attribute
0,8 ( ) @!attribute , . @attr_* . ( 0.8.0 +):
@!attribute
@attr_*
# @!parse attr_accessor :some_attribute
, Ruby. 0,8 attr_accessor , / :
class MyClass attr_accessor :foo def foo; something_else end def foo=(v) something_else(v) end end
Ruby , , ruby -w . , undef foo, foo=. ( -w), , @!parse @!attribute.
ruby -w
undef foo, foo=
@!parse
@attr :
# @attr [String] name The name of this object. class MyClass def name end def name= end end
(, @attr_reader @attr_writer), .