module I18n::Utils
Public Class Methods
# File lib/i18n/utils.rb, line 18 def deep_merge(hash, other_hash, &block) deep_merge!(hash.dup, other_hash, &block) end
# File lib/i18n/utils.rb, line 22 def deep_merge!(hash, other_hash, &block) hash.merge!(other_hash) do |key, this_val, other_val| if this_val.is_a?(Hash) && other_val.is_a?(Hash) deep_merge(this_val, other_val, &block) elsif block_given? yield key, this_val, other_val else other_val end end end
# File lib/i18n/utils.rb, line 34 def deep_symbolize_keys(hash) hash.each_with_object({}) do |(key, value), result| result[key.respond_to?(:to_sym) ? key.to_sym : key] = deep_symbolize_keys_in_object(value) result end end
# File lib/i18n/utils.rb, line 7 def except(hash, *keys) hash.except(*keys) end