RDoc: change the name of the "Attributes:" section in the ri documentation
I use metaprogramming to create a bunch of methods in ruby, for example:
class EmotionalObject
def self.mood( name, *details )
define_method(name) do
# ...
end
end
mood :happy, #...
mood :sad, #...
mood :ebuillent, #...
#...
end
I know I can go through the rdoc
'-A mood' to find out its generating mood as attributes, which is handy since then they will at least find out.
However, they look more like regular methods than attributes, so I don't want them to be listed under "Attributes:" when I look in the documentation with ri
. I don't have any normal attributes, so there is an easy way, I can just change the title of this section to be "Mood:" or something, so my users are at least curious enough to type ri EmotionalObject#happy
.
source to share
It is hardcoded into RDoc templates, but you can create a new template by duplicating the default "html" template and manually changing the title name.
See the source of the RDoc template here: http://github.com/juretta/ruby/blob/master/lib/rdoc/generator/html/html.rb#L601 .
source to share