This page contains automated test results for code from O'Reilly's Ruby Cookbook. If this code looks interesting or useful, you might want to buy the whole book.

Using Symbols as Hash Keys (written by Ben Giddings)
CodeExpectedActual
people = Hash.new
people[:nickname] = 'Matz'
people[:language] = 'Japanese'
people['last name'.intern] = 'Matsumoto'
people[:nickname]
"Matz" "Matz"
people['nickname'.intern]
"Matz" "Matz"
'name'.object_id
-605973716 -605974746
'name'.object_id
-605976356 -605977386
'name'.object_id
-605978996 -605980026
:name.object_id
878862 878862
:name.object_id
878862 878862
'name'.intern.object_id
878862 878862
'name'.intern.object_id
878862 878862