v3.2.3 - Show latest stable - 1 note - Class: Hash
deep_dup() public

Returns a deep copy of hash.

Show source
Register or log in to add new notes.
August 25, 2014 - (v3.1.0 - v3.2.13)
0 thanks

This method does not correctly dup arrays

Watch out because this method does not correctly dup arrays values.

The bug can be reproduced with the following code:

hash = { 'a' => [1,2,3,4] }
dup  = hash.deep_dup
dup['a'].object_id == hash['a'].object_id # should return true

Rails 4 version does not have this issue because it is completely different implementation.