Module: Gemmy::Patches::HashPatch::InstanceMethods::Diff

Defined in:
lib/gemmy/patches/hash_patch.rb

Instance Method Summary collapse

Instance Method Details

#diff(hash) ⇒ Object

facets returns the key-vals from <self> that are not the same in <hash>



216
217
218
219
220
# File 'lib/gemmy/patches/hash_patch.rb', line 216

def diff(hash)
  h1 = self.dup.delete_if{ |k,v| hash[k] == v }
  h2 = hash.dup.delete_if{ |k,v| has_key?(k) }
  h1.merge(h2)
end