Difference between "Class#message" and "Class.message" notation
This is a very basic ruby question. What is the difference between ClassName#message and ClassName.message?
I am reading a basic Ruby guide and I see both references used quite a lot. It seems that mainly in the code ClassName.message is used but in the documentation ClassName#message is used.
Is the # simply documentation convention? Will only the . work for message passing in actual code? Or is there something that I am just missing?
Does the meaning differ in Rails at all?
In code you use object.method. In documentation however, Class#method denotes an instance method (e.g. String#upcase), whereas Class.method or Class::method denotes a class/module method (e.g. Math.log10).
The # is used in the documentations to point out the difference between class methods and instance methods.
In the code, you'll be using . in all the cases.
'#' is rails convention. In rails className#Message will map to Message action of your className controller.
Ex: match "profile" => "users#show"
This will map root_path/profile => Show method(or action) of UserController.