Skip to content

Instantly share code, notes, and snippets.

@raypereda
Created March 28, 2014 17:49
Show Gist options
  • Save raypereda/9838716 to your computer and use it in GitHub Desktop.
Save raypereda/9838716 to your computer and use it in GitHub Desktop.
def diff(one, other)
(one.keys + other.keys).uniq.inject({}) do |memo, key|
unless one.key?(key) && other.key?(key) && one[key] == other[key]
memo[key] = [one.key?(key) ? one[key] : :_no_key, other.key?(key) ? other[key] : :_no_key]
end
memo
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment