Drew Olson wrote:
> Adriano Ferreira wrote:
>> You're missing "to_s"
>> 
>> $ irb
>> irb> class Foo; end
>> => nil
>> irb> Foo.new
>> => #<Foo:0x1001380c>         <-- default stringification
>> 
>> irb> class Foo; def to_s; "a Foo"; end end
>> => nil
>> irb> Foo.new
>> => a Foo                  <-- customized stringification
>> 
>> irb> quit
> 
> This is a little nit-picky, but this code won't actually work unless 
> you've modified irb 

Whoops, I take that back, I was unaware that creating an instance of an 
object called #to_s in irb. However, I think demonstrating printing an 
instance makes a bit more sense here. My bad!

-Drew


-- 
Posted via http://www.ruby-forum.com/.