These are "instance methods" - they operate on an instance of an Array
, not the Array
class itself. If you were to put self.
before the name of each method when defining it, you would be defining a "class method", which wouldn't make any sense for these methods.
Although not necessary, the reason that self.
works when invoking these methods from within the body of another one of the methods is that self
is defined to be the "instance" at that point. This contrasts to when you're defining the methods with def
, where self
is the Array
class.