Sha256: 6294557a80fe5e30694914ffebd1befe37e62a634ca7626c9a77a8bd6a2747cd

Contents?: true

Size: 198 Bytes

Versions: 17

Compression:

Stored size: 198 Bytes

Contents

class Hash

  # Difference comparison of two hashes.

  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

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
facets-2.8.4 lib/core/facets/hash/diff.rb
facets-2.8.3 lib/core/facets/hash/diff.rb
facets-2.8.2 lib/core/facets/hash/diff.rb
facets-2.8.1 lib/core/facets/hash/diff.rb
facets-2.8.0 lib/core/facets/hash/diff.rb
facets-2.7.0 lib/core/facets/hash/diff.rb
facets-2.6.0 lib/core/facets/hash/diff.rb
facets-2.4.0 lib/facets/hash/diff.rb
facets-2.4.1 lib/facets/hash/diff.rb
facets-2.4.4 lib/core/facets/hash/diff.rb
facets-2.4.3 lib/core/facets/hash/diff.rb
facets-2.4.2 lib/core/facets/hash/diff.rb
facets-2.5.0 lib/core/facets/hash/diff.rb
facets-2.4.5 lib/core/facets/hash/diff.rb
facets-2.5.1 lib/core/facets/hash/diff.rb
facets-2.5.2 lib/core/facets/hash/diff.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/hash/diff.rb