If a method name ends in an equals sign (=), as in family_name=
the method is a "setter,"
class Name
def family_name=( family )
@family_name = family
end
def given_name=( given )
@given_name = given
end
end
n = Name.new
n.family_name= "Matsumoto" # => "Matsumoto"
n.given_name= "Yukihiro" # => "Yukihiro"
p n # => <Name:0x1d441c @family_name="Matsumoto", @given_name="Yukihiro">
Related examples in the same category