[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: With and without Song#to_s

Li Chen

12/30/2006 2:04:00 AM



--- Timothy Hunter <TimHunter@nc.rr.com> wrote:
> 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.

What I don't understand is that I don't call Song#to_s
in my script why does it affect my codes?

Thanks,

Li



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...

1 Answer

Tim Hunter

12/30/2006 2:12:00 AM

0

chen li wrote:
> --- Timothy Hunter <TimHunter@nc.rr.com> wrote:
>
>> 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.
>>
>
> What I don't understand is that I don't call Song#to_s
> in my script why does it affect my codes?
>
puts calls to_s