class Hash
Public Instance Methods
deep_merge(hash)
click to toggle source
# 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)
click to toggle source
# File lib/spectra/utilities.rb, line 112 def pick(*keys) self.select { |key, value| keys.include?(key) } end