Module: HelpfulUtils::CoreExt::Array

Included in:
Array
Defined in:
lib/helpful_utils/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#clone_by_someway(value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/helpful_utils/core_ext/array.rb', line 4

def clone_by_someway(value)
  return value if value.is_a?(Symbol)
  if value.respond_to?(:deep_clone)
    value.deep_clone
  else
    value.clone
  end
end

#deep_cloneObject



13
14
15
# File 'lib/helpful_utils/core_ext/array.rb', line 13

def deep_clone
  self.collect{|v| clone_by_someway(v)}
end