The self
keyword allows for access to the current object.
When you call a method on an object, such as object.method
, the object
receives a method
message. The object
will respond to the method
if there is a method defined for it. Inside that method, you have access to the object
via the keyword self
.
When you call a method without an explicit receiving object, it just calls it on self
.
If you are inside an instance method but need access to a class method, you would use self.class.method_you_want