class Hash

     #######    ########    #######    ########    ########
/ / / /    License    \ \ \ \

Copyleft culture, Copyright (C) is prohibited here This work is licensed under a CC BY-SA 4.0 Creative Commons Attribution-ShareAlike 4.0 License Refer to the creativecommons.org/licenses/by-sa/4.0/

#######    ########    #######    ########    ########

/ / / / Code Climate \ \ \ \ Language = ruby Indent = space; 2 chars;

#######    ########    #######    ########    ########

Public Instance Methods

diff(other) click to toggle source
# File lib/tooling/ruby.rb, line 13
def diff(other)
  (self.keys + other.keys).uniq.inject({}) do |memo, key|
    unless self[key] == other[key]
      if self[key].kind_of?(Hash) &&  other[key].kind_of?(Hash)
        memo[key] = self[key].diff(other[key])
      else
        memo[key] = [self[key], other[key]] 
      end
    end
    memo
  end
end