Method: MacAdmin::DSLocalRecord#diff

Defined in:
lib/macadmin/dslocal.rb

#diff(other) ⇒ Object

Diff two records

  • of limited value except for debugging

  • output is not very coherent



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/macadmin/dslocal.rb', line 97

def diff(other)
  this = self.record
  other = other.record
  (this.keys + other.keys).uniq.inject({}) do |memo, key|
    unless this[key] == other[key]
      if this[key].kind_of?(Hash) &&  other[key].kind_of?(Hash)
        memo[key] = this[key].diff(other[key])
      else
        memo[key] = [this[key], other[key]] 
      end
    end
    memo
  end
end