Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/metamri/core_additions.rb
Overview
Find hash differences.
Instance Method Summary collapse
Instance Method Details
#diff(other) ⇒ Object
227 228 229 230 231 232 233 234 |
# File 'lib/metamri/core_additions.rb', line 227 def diff(other) self.keys.inject({}) do |memo, key| unless self[key] == other[key] memo[key] = [self[key], other[key]] end memo end end |
#similar(other) ⇒ Object
236 237 238 239 240 241 242 243 |
# File 'lib/metamri/core_additions.rb', line 236 def similar(other) self.keys.inject({}) do |memo, key| if self[key] == other[key] memo[key] = self[key] end memo end end |