According to the axe book (2nd edition), we can use to_s as follows.
class Song def to_s "Song" end end song = Song.new() song.to_s
But, it doesn't give me anything, in order to print something to the stdout, I should run
def to_s p "Song" end
Is there any change since the ruby 1.8.2 when the book was written for? My ruby version info is 1.8.7 for Mac.
ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]