Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/spectra/utilities.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge(hash) ⇒ Object
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/spectra/utilities.rb', line 116 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
112 113 114 |
# File 'lib/spectra/utilities.rb', line 112 def pick(*keys) self.select { |key, value| keys.include?(key) } end |