Sha256: 67c955ee8faa8222986491d499c737b0e9681f4fa2c0ec34a5efeab5f4393f07

Contents?: true

Size: 243 Bytes

Versions: 55

Compression:

Stored size: 243 Bytes

Contents

class Hash
  # - should not affect the original
  # nor delete if the key + value pair aren't equal
  def -(hash)
    out = self.dup
    hash.keys.each do |key|
      out.delete key if self[key] == hash[key]
    end
    out
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
sane-0.25.8 lib/sane/hash_minus_hash.rb
sane-0.25.7 lib/sane/hash_minus_hash.rb
sane-0.25.6 lib/sane/hash_minus_hash.rb
sane-0.25.5 lib/sane/hash_minus_hash.rb
sane-0.25.4 lib/sane/hash_minus_hash.rb
sane-0.25.3 lib/sane/hash_minus_hash.rb
sane-0.25.2 lib/sane/hash_minus_hash.rb
sane-0.25.1 lib/sane/hash_minus_hash.rb
sane-0.25.0 lib/sane/hash_minus_hash.rb
sane-0.24.6 lib/sane/hash_minus_hash.rb
sane-0.24.5 lib/sane/hash_minus_hash.rb
sane-0.24.4 lib/sane/hash_minus_hash.rb
sane-0.24.3 lib/sane/hash_minus_hash.rb
sane-0.23.6 lib/sane/hash_minus_hash.rb
sane-0.24.2 lib/sane/hash_minus_hash.rb
sane-0.24.1 lib/sane/hash_minus_hash.rb
sane-0.24.0 lib/sane/hash_minus_hash.rb
sane-0.23.5 lib/sane/hash_minus_hash.rb
sane-0.23.4 lib/sane/hash_minus_hash.rb
sane-0.23.3 lib/sane/hash_minus_hash.rb