From: Florent Vaucelle Date: 2010-02-20T01:45:18+09:00 Subject: [ruby-core:28252] [Bug #2764] Hash.new inconsistency when initialized with an enumerable Bug #2764: Hash.new inconsistency when initialized with an enumerable http://redmine.ruby-lang.org/issues/show/2764 Author: Florent Vaucelle Status: Open, Priority: Normal ruby -v: ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9] When initializing a Hash with an enumerable as default value, Hash.new(obj) and Hash.new(&block) have different behaviours. Example: h = Hash.new([]) h[10] << 20 h #=> {} h = Hash.new { |hash, key| hash[key] = [] } hash[10] << 20 h #=> {10=>20} The example similar when using a String instead of an Array as default value. ---------------------------------------- http://redmine.ruby-lang.org