class Grape::Extensions::DeepMergeableHash

Public Instance Methods

deep_merge!(other_hash) click to toggle source
# File lib/grape/extensions/deep_mergeable_hash.rb, line 6
def deep_merge!(other_hash)
  other_hash.each_pair do |current_key, other_value|
    this_value = self[current_key]

    self[current_key] = if this_value.is_a?(::Hash) && other_value.is_a?(::Hash)
                          this_value.deep_merge(other_value)
                        else
                          other_value
                        end
  end

  self
end