Search code examples
rubydocumentation

Why are methods in Ruby documentation preceded by a hash sign?


When I see any Ruby method printed in text, it usually appears as:

Class#method

or

#method

Now, I would use:

Class.method

Why are all Ruby methods preceded by a pound sign? Is there any reason for it?


Solution

  • From the rdoc docs (emphasis mine):

    Names of classes, source files, and any method names containing an underscore or preceded by a hash character are automatically hyperlinked from comment text to their description.