Sam Roberts wrote:
I thought I saw discussion about this once, but I don’t see anything in
the current rdoc docs (RDoc Documentation).Treating methods as attrs if they were defined with attr, attr_reader,
etc. seems to break the whole point of uniform access, its just
an implmentation technique.The defaults are often great, but is there any way, say a “#
:attr(r,w):” comment, that I can use to get some of my methods to show
up in the “Attributes” section of the docs?
This isn’t exactly what you’re looking for, but maybe it helps.
The rdoc help says:
--accessor, -A accessorname[,..]
comma separated list of additional class methods
that should be treated like 'attr_reader' and
friends. Option may be repeated. Each accessorname
may have '=text' appended, in which case that text
appears where the r/w/rw appears for normal accessor
So for example if you have
class Person
string_attribute :name
end
and you have defined a class method #string_attribute in some way, the
the rdoc option
–accessor string_attribute=string
will cause “name [string]” to show up in the Attributes section of the
doc for Person.