Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/spectra/utilities.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge(hash) ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/spectra/utilities.rb', line 104 def deep_merge(hash) worker = proc do |key, source, update| if source.is_a?(Hash) && update.is_a?(Hash) source.merge(update, &worker) else update end end self.merge(hash, &worker) end |
#pick(*keys) ⇒ Object
100 101 102 |
# File 'lib/spectra/utilities.rb', line 100 def pick(*keys) self.select { |key, value| keys.include?(key) } end |