Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/hash.rb

Overview

Monkey patch for diff method

Instance Method Summary collapse

Instance Method Details

#diff(other) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/hash.rb', line 4

def diff(other)
  self.keys.inject({}) do |memo, key|
    unless self[key] == other[key]
      memo[key] = [self[key], other[key]]
    end
    memo
  end
end