Class: Hash
- Defined in:
- lib/sane/hash_hashes.rb,
lib/sane/hash_minus_hash.rb
Instance Method Summary collapse
-
#-(hash) ⇒ Object
-
should not affect the original nor delete if the key + value pair aren’t equal.
-
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
Instance Method Details
#-(hash) ⇒ Object
-
should not affect the original
nor delete if the key + value pair aren’t equal
4 5 6 7 8 9 10 |
# File 'lib/sane/hash_minus_hash.rb', line 4 def -(hash) out = self.dup hash.keys.each do |key| out.delete key if self[key] == hash[key] end out end |
#eql?(other) ⇒ Boolean
13 14 15 |
# File 'lib/sane/hash_hashes.rb', line 13 def eql?(other) self == other end |
#hash ⇒ Object
9 10 11 |
# File 'lib/sane/hash_hashes.rb', line 9 def hash inject(0) {|hash,pair| hash ^ pair.hash} end |