O'Reilly logo
  • Joe Walsh thinks this is interesting:

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">

From

Cover of Learning Ruby
  • Methods
  • from Learning Ruby
  • by Michael Fitzgerald
  • Publisher: O'Reilly Media, Inc.
  • Released: May 2007

Note

CB: muse on syntax of setter