tags:

views:

125

answers:

2

Possible Duplicate:
Why are methods in ruby documentation preceded by a pound sign?

EDIT: Duplicate of Why are methods in ruby documentation preceded by a pound sign?

Hi,

I'm trying to learn Ruby for fun at my spare time with the free Programming Ruby book. It is mostly fairly straight forward but I kept seeing notations like this *KaraokeSong#to_s*, which is not really explained in the earlier chapters of the book.

I know it meant <class>#<method> but it is something you can use in the code? or just a notation ruby programmers use to specifiy a method like <class>::<method> notation used by C++ programmers?

+1  A: 

From the rdoc docs:

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.

BTW, I asked the same question some time ago :-)

Ed Swangren
really? I did browse through the list of suggestions before I ask the question. Anyway, so does it mean its just used for rdoc to generate document? So you can't really use class#method to say get the reference to a method object using this notation?
oykuo
Yeah, it's not always easy to find stuff around here.
Ed Swangren
+7  A: 

# = instance method

:: = class method

Andy Gaskell