In Ruby they are treated differently, there’s a syntax sugar for methods
ending with the “=” character.
So,
self.setter=(value)
And
self.setter = value
Are the same.
There’s other internal differences. One of them I’m aware of is, on
setters
the returned values is always the value of the assignment (right value)
not
the value returned by the method.
Abinoam Jr.
Em 13/01/2014 05:25, “Marc H.” [email protected] escreveu:
Yes, of-course. But in that case set_foo will not be called as setter. It is simply a method which is setting/assigning the value
to the instance variable @foo.
In Ruby they are treated differently, there’s a syntax sugar for methods
ending with the “=” character.
There’s other internal differences. One of them I’m aware of is, on
setters
the returned values is always the value of the assignment (right value)
not
the value returned by the method.