Closed lvl0nax closed 8 years ago
'fast' method has different result from other methods. Because:
ORIGINAL_HASH = { foo: "foo" } #fast { foo: 'bar' }.merge!(ORIGINAL_HASH) #=> {:foo=>"foo"} #slow ORIGINAL_HASH.merge(foo: 'bar') #=> {:foo=>"bar"} #slow_dup ORIGINAL_HASH.dup.merge!(foo: 'bar') #=> {:foo=>"bar"} #new fast { foo: 'bar' }.merge!(ORIGINAL_HASH){ |_key, left, _right| left } #=> {:foo=>"bar"}
Thanks!
'fast' method has different result from other methods. Because: