Module: AbideDevUtils::Mixins::Hash

Defined in:
lib/abide_dev_utils/mixins.rb

Overview

mixin methods for the Hash data type

Instance Method Summary collapse

Instance Method Details

#deep_copyObject



7
8
9
# File 'lib/abide_dev_utils/mixins.rb', line 7

def deep_copy
  Marshal.load(Marshal.dump(self))
end

#diff(other) ⇒ Object



11
12
13
# File 'lib/abide_dev_utils/mixins.rb', line 11

def diff(other)
  dup.delete_if { |k, v| other[k] == v }.merge!(other.dup.delete_if { |k, _| key?(k) })
end