Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/ncc/instance.rb
Instance Method Summary collapse
Instance Method Details
#deep_soft_merge(other) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ncc/instance.rb', line 21 def deep_soft_merge(other) r = self.dup other.each_pair do |key, value| if r.has_key? key if r[key].respond_to? :to_hash and other[key].respond_to? :to_hash r[key] = r[key].to_hash.deep_soft_merge(other[key].to_hash) end else r[key] = value end end r end |
#delete_nil_values ⇒ Object
37 38 39 40 |
# File 'lib/ncc/instance.rb', line 37 def delete_nil_values self.keys.each { |k| delete(k) if self[k].nil? } self end |