chen li wrote:
> #########
> class Song  
>   def initialize(name,artist,duration)
>     @name=name
>     @artist=artist
>     @duration=duration
>   end 
>   #attr_reader :name, :artist, :duration 
>   
>   def to_s
>    "#@name\t#@artist\t\t#@duration"
>   end
> end
> 
> 
> s=Song.new('song1','author1','20')
> puts s
> 
> ######output
>> ruby ruby20c.rb
> song1	author1		20
>> Exit code: 0

  As s is not a String (that is not s.is_a? String), it is converted
into string by puts. That exactly means your method to_s is called for
doing so.

	Vince
-- 
Vincent Fourmond, PhD student
http://vincent.fourmond.neuf.fr/