-
It is idiomatic to prefer to omit
self.when invoking methods; it is generally never needed. -
You must use
self.foo = xxxwhen calling a setter method, instead offoo = xxx, so that Ruby realizes that you are not trying create a new local variable.- Similarly, in the unlikely event that you have an existing local variable
do_somethingwith the same name as a method, you must useself.do_somethingto invoke the method, as justdo_somethingwill end up reading the variable.
- Similarly, in the unlikely event that you have an existing local variable
-
You cannot use
self.foo(...)to call a private method; you must instead call justfoo(...).