module Basquiat::HashRefinements
Public Instance Methods
deep_merge(other_hash)
click to toggle source
# File lib/basquiat/support/hash_refinements.rb, line 15 def deep_merge(other_hash) other_hash.each_pair do |key, value| current = self[key] if current.is_a?(Hash) && value.is_a?(Hash) current.deep_merge(value) else self[key] = value end end self end
symbolize_keys()
click to toggle source
# File lib/basquiat/support/hash_refinements.rb, line 27 def symbolize_keys each_with_object({}) do |(key, value), new_hash| new_key = begin key.to_sym rescue StandardError key end new_value = value.is_a?(Hash) ? value.symbolize_keys : value new_hash[new_key] = new_value end end