Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/kintsugi/utils.rb

Instance Method Summary collapse

Instance Method Details

#deep_cloneHash

Provides a deep clone of ‘self`

Returns:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kintsugi/utils.rb', line 26

def deep_clone
  transform_values do |value|
    begin
      value.deep_clone
    rescue NoMethodError
      value.clone
    end
  rescue NoMethodError
    value
  end
end