The @encrypt_password@ method is indeed an instance method. In Ruby, the keyword @self@ refers to the current object. This is similar to calling @$this->salt = …@ in PHP. Much of the time in Ruby, we don’t need to prefix the method with @self.@ because @self@ is implied. In this very method we refer to the @email@ method without using the @self.@ prefix, and Ruby implicitly knows to check instance methods for the value of @email@.
The difference is that in the case of @self.salt = … @ and @self.encrypted_password = …@, we’re assigning a variable. In this case Ruby doesn’t know if we want to set the local variable @salt@ or the @salt@ method on the current User object. The only way to let Ruby know that we want to assign the User’s @salt@ method is to explicitly use @self.salt = …@ to do so.
The @self@ keyword is used in the context of both classes and objects because classes are in fact objects themselves in Ruby.
Here is an article that explains @self@ a little better:
Hope this helps!