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

apple-mobile-web-app-title for Chrome

javascript android html ios html5

The original question was falsely duplicated, and hasn't been opened for over a year, so I'm asking it again. Link: "apple-mobile-web-app-title" on Android

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.