Class: Array

Inherits:
Object show all
Defined in:
lib/raven/core_ext/object/deep_dup.rb

Instance Method Summary collapse

Instance Method Details

#deep_dupObject

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

31
32
33
# File 'lib/raven/core_ext/object/deep_dup.rb', line 31

def deep_dup
  map(&:deep_dup)
end