Method: Array#deep_dup
- Defined in:
- lib/active_support/core_ext/object/deep_dup.rb
#deep_dup ⇒ Object
Returns a deep copy of array.
array = [1, [2, 3]]
dup = array.deep_dup
dup[1][2] = 4
array[1][2] # => nil
dup[1][2] # => 4
29 30 31 |
# File 'lib/active_support/core_ext/object/deep_dup.rb', line 29 def deep_dup map(&:deep_dup) end |