module Djin::HashExtensions
Public Instance Methods
deep_merge(other_hash)
click to toggle source
# File lib/djin/extensions/hash_extensions.rb, line 14 def deep_merge(other_hash) dup.deep_merge!(other_hash) end
deep_merge!(other_hash)
click to toggle source
# File lib/djin/extensions/hash_extensions.rb, line 18 def deep_merge!(other_hash) merge!(other_hash) do |_, this_val, other_val| if this_val.is_a?(Hash) && other_val.is_a?(Hash) this_val.deep_merge(other_val) else other_val end end end
except(*keys)
click to toggle source
# File lib/djin/extensions/hash_extensions.rb, line 6 def except(*keys) reject { |key, _| keys.include?(key) } end
symbolize_keys()
click to toggle source
# File lib/djin/extensions/hash_extensions.rb, line 10 def symbolize_keys map { |key, value| [key.to_sym, value] }.to_h end