Mega Code Archive
Define a method to retrieve the value
class Horse
def name
@name = "Easy Jet"
end
end
h = Horse.new
h.name
# The method name is the kind of method that is referred to as an accessor method or getter.
# It gets a property (the value of a variable) from an instance of a class.