Tim Hunter
12/30/2006 1:40:00 AM
chen li wrote:
> Happy holiday for all!
>
> I have two classes (most of them copied from Pickaxe
> 2)and they work fine. But I get the address for
> each object if I comment out method Song#to_s. How to
> explain them?
>
> T
puts calls to_s on each object that it writes. If you don't supply a
to_s method for your class then the to_s method in your class's
superclass will be used. Since the superclass is Object, the Object#to_s
method is used. This version of to_s simply formats the object's class
and its id as a string.
ri Object#to_s for more information.