|| at Nov 28, 2012 at 2:02 pm
On Wed, Nov 28, 2012 at 6:46 AM, thil wrote:
Self.methods is static methods using the class name itself you can call the
methods and is not available to the instance of the class.
There is no such thing as static methods in Ruby. self.method_name
(or sometimes self.class.method_name) are instance methods on the
singleton instance of the object (in 1.9 you can access the singleton
via singleton_class too). Since everything is an object in Ruby
(literally) you have multiple types of instances, in his case he is
accessing instance methods on the singleton (or anonymous class or
eigen, however you want to label it) vs instance methods on /an/
instance of that object.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.