One of the examples in Peter Cooper's Beginning Ruby for polymorphism involves the to_s
method. He gives this example:
puts 1000.to_s
puts [1, 2, 3].to_s
puts ({ :name => 'Fred', :age => 10 }).to_s
and shows this as the output:
1000
123
age10nameFred
but the output I get is:
1000
[1, 2, 3]
{:name=>"Fred", :age=>10}
Does anyone know why this would be the case? Was there a change in ruby, or is there something I'm doing wrong? Or not enough info to tell? How can I find it out?