class ReeHash::Merge
def call(first_hash, other_hash, deep: true, &block)
def call(first_hash, other_hash, deep: true, &block) recursively_merge(first_hash, other_hash, deep, &block) end
def recursively_merge(first_hash, other_hash, deep, &block)
def recursively_merge(first_hash, other_hash, deep, &block) first_hash.merge(other_hash) do |key, first_val, other_val| if first_val.is_a?(Hash) && other_val.is_a?(Hash) && deep recursively_merge(first_val, other_val, deep) elsif block_given? yield key, first_val, other_val else other_val end end end