Ok, so I wanted to create a hash which has an empty hash as the default value. A bit weird, I know, but let's say that I thought it might be useful.
So here's what I did:
>> a = Hash.new({})
=> {}
>> a[:a][:b] = 5
=> 5
>> a
=> {}
>> a[:a]
=> {:b=>5}
>> a.keys
=> []
>> a.size
=> 0
>> a[:a].size
=> 1
In other words, I don't see hash member when I inspect the hash, but I can access it by its key.
Is this expected behavior? What is going on here?
BTW, this is Ruby 1.9.1, haven't tried earlier versions.
Edit: simplified example as it doesn't have to be a hash of hashes of hashes...