0

I am using Ruby on Rails 3.0.7 and I am trying to understand how the RDoc system works. So I would like to understand what the "hash" value means when the official documentation refers to that on line 7:

  1. 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.

Can you make me an example of stating that in my commented code? Have you some advice about using that?


BTW: Do you have a "MUST READ" resource referring to RDoc? If so, can you provide that?

user502052
  • 14,803
  • 30
  • 109
  • 188

1 Answers1

2

They mean the # symbol.

When referring to a method in text, it is typical for you to prepend a hash to it. For example: "In order to convert array to a string, call #to_s". Now, rdoc will notice the hash and turn it into a link to the documentation for the method to_s.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Jeremy
  • 22,188
  • 4
  • 68
  • 81
  • 1
    The notation using hash allows you to mention instance methods without refering to a particular instance, e.g., `Array#to_s`. It allows you to distinguish it from `Array#to_s`, which will mean class/module method. – sawa Jun 26 '11 at 05:06
  • 1
    @sawa, Do you mean to distinguish from Array.to_s? – ebsbk Aug 04 '11 at 14:22
  • @ebsbk Yes. That was my mistyping. Thanks. – sawa Aug 04 '11 at 14:27