From: Brian Candler Date: 2007-05-09T00:32:48+09:00 Subject: Equality question I am trying to use complex values as hash keys (they are actually method calls caught by method_missing). However strange things are happening. Can someone explain what's happening here please where marked? confs = {"default" => "! Config\nfoo=bar\n"} hash = { [:firmware_id] => "12.4.8", [:uptime] => 0, [:read_configs] => confs, [:defuzz_configs, confs] => {"default" => "foo=bar\n"}, [:defuzz_configs, {"conf"=>"foo.txt"}] => {"default" => "foo=bar\n"}, } p hash.size key1 = [:defuzz_configs, confs] p hash[key1] # this works key2 = [:defuzz_configs, {"conf"=>"foo.txt"}] p hash[key2] # this prints nil ?? <<<<<<<<<<< o1 = [:defuzz_configs, {"conf"=>"foo.txt"}] o2 = [:defuzz_configs, {"conf"=>"foo.txt"}] p o1 == o2 # prints true p o1.hash == o2.hash # prints false ?? <<<<<<<<<<< Thanks! Brian.