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
158 159 160 161 162 163 164 165 |
# File 'lib/metamri/core_additions.rb', line 158 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
167 168 169 170 171 172 173 174 |
# File 'lib/metamri/core_additions.rb', line 167 def similar(other) self.keys.inject({}) do |memo, key| if self[key] == other[key] memo[key] = self[key] end memo end end |