instance method
deep_dup
Ruby on Rails 5.2.8.1
Since v4.0.13Signature
deep_dup()
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
Source
# File activesupport/lib/active_support/core_ext/object/deep_dup.rb, line 29
def deep_dup
map(&:deep_dup)
end
Defined in activesupport/lib/active_support/core_ext/object/deep_dup.rb line 29
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Array