I was going through Ruby Koans tutorial series, when I came upon this in about_hashes.rb:
def test_default_value_is_the_same_object
hash = Has
When you're doing hash = Hash.new([]) you are creating a Hash whose default value is the exact same Array instance for all keys. So whenever you are accessing a key that doesn't exist, you get back the very same Array.
h = Hash.new([])
h[:foo].object_id # => 12215540
h[:bar].object_id # => 12215540
If you want one array per key, you have to use the block syntax of Hash.new:
h = Hash.new { |h, k| h[k] = [] }
h[:foo].object_id # => 7791280
h[:bar].object_id # => 7790760
Edit: Also see what Gazler has to say with regard to the #<< method and on what object you are actually calling it.