On Sun, 23 Dec 2007 01:22:17 -0800, Davo wrote:
I’ve read it is something to do with Class Methods ?
I’m a newbie to ruby, and this is really a ruby question, rather than a
rails question, but, yes, it signifies class methods.
An instance method will give varying results – unique to each instance
(object). The simplest example of an instance method (coming from Java)
would be the getter/setter methods.
foo.set_var = 5
foo.print_var #will print “5”
bar.set_var = 10
bar.print_var #will print “10”
Here, the same method will give different results. For object foo, the
result is 5, for object bar the result is 10.
Conversely, consider:
myMath.sin(x)
Do you want the above to give different results for different instances?
I would hope not!
-Thufir