Method: Array#deep_dup

Defined in:
lib/sc-core-ext/array.rb

#deep_dupObject

Performs a “deep copy” of this array; that is, returns an Array that is a duplicate of this Array, and whose elements have each, in turn, had #deep_dup or #dup called on them. This should produce an Array whose every element is a copy of the original.

This operation is expensive, and should be used sparingly.



7
8
9
10
11
# File 'lib/sc-core-ext/array.rb', line 7

def deep_dup
  self.collect do |ele|
    ele.respond_to?(:deep_dup) ? ele.deep_dup : ele.dup?
  end
end