I want to understand why a
in the following is an empty hash after a[:a]
is called, which is not empty:
a = Hash.new({a:1}) # => {}
a[:a][:a] += 1 # => 2
a # => {}
a[:a] # => {:a=>2}
I know that {a: 1}
is shared between every inexistent key (a[:something_inexistent]
). But why isn't it displayed as a key of a
? If possible, using Ruby's internal would be much appreciated.