Within an instance method of a class self
refers to that instance. To get the class within an instance you can call self.class
. If you call self
within a class method, you get the class. Inside a class method you can't access any instance of the class.