Equivalent to self . This is also implied. So self.first_name same as first_name inside the class if you are not doing the job.
class Book attr_reader :first_name, :last_name def full_name # this is the same as self.first_name + ", " + self.last_name first_name + ", " + last_name end end
When doing the job, you need to explicitly use self , since Ruby does not know whether you assign a local variable named first_name or assign instance.first_name .
class Book def foo self.first_name = "Bar" end end
source share