class to string
#!/usr/bin/env ruby 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= "A" # => "A" n.given_name= "B" # => "B" p n #<Name:0x325140 @family_name="A", @given_name="B">
1. | Getting a Human-Readable Printout of Any Object | ||
2. | Override a to_s method after inheritance | ||
3. | Format ourselves as a string by appending our lyrics to our parent's #to_s value. |