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?
class. / (klɑːs) / noun. a collection or division of people or things sharing a common characteristic, attribute, quality, or property. a group of persons sharing a similar social position and certain economic, political, and cultural characteristics.
1a : a group of students meeting regularly to study the same subject. b : the period during which such a group meets. c : a course of instruction. d : a group of students who graduate together class of 1990.
#
= instance method
::
= class method
Per ruby docs:
Use :: for describing class methods, # for describing instance methods, and use . for example code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With