R
rpardee
Hey All,
This surprised me:
hash_hash = Hash.new(Hash.new(0))
hash_hash[:foo][:bar] += 1
hash_hash[:foo][:baz] += 1
puts(hash_hash[:foo].keys.inspect) # => [:baz, :bar]
puts(hash_hash.keys.inspect) # => [] ?
Shouldn't hash_hash.keys == [:foo]? I'm running ruby 1.8.6
(2007-03-13 patchlevel 0) [i386-mswin32].
If this is expected behavior, what's the easiest/best performing way
to make sure those keys are added?
Many thanks!
-Roy
This surprised me:
hash_hash = Hash.new(Hash.new(0))
hash_hash[:foo][:bar] += 1
hash_hash[:foo][:baz] += 1
puts(hash_hash[:foo].keys.inspect) # => [:baz, :bar]
puts(hash_hash.keys.inspect) # => [] ?
Shouldn't hash_hash.keys == [:foo]? I'm running ruby 1.8.6
(2007-03-13 patchlevel 0) [i386-mswin32].
If this is expected behavior, what's the easiest/best performing way
to make sure those keys are added?
Many thanks!
-Roy