class Hash
Public Instance Methods
deep_merge(other)
click to toggle source
# File lib/foundry/refinements/hash.rb, line 2 def deep_merge(other) dup.deep_merge!(other) end
deep_merge!(other)
click to toggle source
# File lib/foundry/refinements/hash.rb, line 6 def deep_merge!(other) other.each_pair do |other_key, other_value| this_value = self[other_key] if this_value.is_a?(Hash) && other_value.is_a?(Hash) self[other_key] = this_value.deep_merge(other_value) else self[other_key] = other_value end end self end
without(*keys)
click to toggle source
# File lib/foundry/refinements/hash.rb, line 18 def without(*keys) dup.without!(*keys) end
without!(*keys)
click to toggle source
# File lib/foundry/refinements/hash.rb, line 22 def without!(*keys) self.reject! { |key, _| keys.include?(key) }; self end