Sorry, middle button operator trouble :)

irb(main):001:0> h = Hash.new({})
=> {}
irb(main):002:0> h[:a][:b] = 12345 # single default object now = 12345
=> 12345
irb(main):003:0> h
=> {}
irb(main):004:0> h[:xyzzy]
=> {:b=>12345}
irb(main):005:0> h[0]
=> {:b=>12345}
irb(main):006:0> h[0].object_id == h[:xyzzy].object_id
=> true
irb(main):007:0> h[109123].object_id == h[:not_there].object_id
=> true
irb(main):008:0> h
=> {}
irb(main):009:0> h = Hash.new {|hash,key| hash[key] = {}}
=> {}
irb(main):010:0> h[:a][:b] = 12345
=> 12345
irb(main):011:0> h
=> {:a=>{:b=>12345}}
irb(main):012:0> h.keys
=> [:a]
irb(main):013:0> h.values
=> [{:b=>12345}]


-- 
Posted via http://www.ruby-forum.com/.