From: John Winters Date: 2008-08-01T05:31:14+09:00 Subject: Re: Needing help with which to_s gets called Sebastian Hungerecker wrote: > John Winters wrote: >> Why when Able is a sub-class of Array does my to_s method get ignored? > > Because puts special cases arrays, not calling to_s on them at all. > If you compare puts [1,2,3] to puts [1,2,3].to_s you will see > that this is the case (puts [1,2,3] is just like puts 1,2,3 printing > each number on its own line instead of having it all in one line like > you get with to_s. Thanks for that. There certainly seems to be some sort of special-casing going on, but it's more widespread than just puts. I tried the test case which you suggested and see exactly what you said. However I also went back to my original code and changed the "puts" line from: puts item to: output = item.to_s puts output and I still get the same oddity so it's clearly not just puts doing it. Do you have a reference where I can read up more on this? TIA, John -- Posted via http://www.ruby-forum.com/.