RDoc : Change name of 'Atttributes:' section in ri-documentation

I'm using some meta-programming to generate a bunch of methods in ruby like so:

class EmotionalObject
  def self.mood( name, *details )
    define_method(name) do
      # ...
    end
  end

  mood :happy, #...
  mood :sad, #...
  mood :ebuillent, #...
  #...
 end

I know that I can pass rdoc '-A mood' to get it to recognize my mood generation code as attributes, which is handy, since then they at least get recognized.

However, they're really more like regular methods than attributes, so I don't want them listed under the 'Attributes:' section when I look at the documentation using ri. I don't have any regular attributes, so is there any simple way I can just change the title of this section to be 'Moods:' or something like that, so my users are at least curious enough to type ri EmotionalObject#happy.

Answers


It's hardcoded into the RDoc templates, but you can make a new template to use by duplicating the default "html" template and changing the heading name by hand.

See the RDoc template source here: http://github.com/juretta/ruby/blob/master/lib/rdoc/generator/html/html.rb#L601.


It appears that somewhere around rdoc 2.4.1 they removed --accessor and replaced it with using ## comments on each meta-method. While this allows you to get them out of the attributes section, it also forces you to comment each one individually.

http://rdoc.rubyforge.org/RDoc/Parser/Ruby.html


Need Your Help

Is spawning new threads via a LINQ Select call bad code?

c# multithreading linq delegates side-effects

ReSharper refactored a foreach loop I had to something like this. I wanted to spawn a bunch of threads via a delegate's BeginInvoke with different parameters, stored in a list, and store the

How do I stop Django from adding path before links?

html django templates views hyperlink

Django insists on adding the current path before a link i put into an a> tag on my page : example: