def hash_merge(oldhash, newhash)
      merge_compound_or_clauses!(oldhash, newhash)
      oldhash.merge(newhash) do |key, oldval, newval|
        old_is_hash = oldval.instance_of? Hash
        new_is_hash = newval.instance_of? Hash

        if old_is_hash && new_is_hash
          hash_merge(oldval, newval)
        elsif old_is_hash
          modifier_merge(oldval, newval)
        elsif new_is_hash
          modifier_merge(newval, oldval)
        else
          merge_values_into_array(oldval, newval)
        end
      end
    end
def hash_merge(oldhash, newhash)
      merge_compound_or_clauses!(oldhash, newhash)
      oldhash.merge(newhash) do |key, oldval, newval|
        old_is_hash = oldval.instance_of? Hash
        new_is_hash = newval.instance_of? Hash

        if old_is_hash && new_is_hash
          hash_merge(oldval, newval)
        elsif old_is_hash
          modifier_merge(oldval, newval)
        elsif new_is_hash
          modifier_merge(newval, oldval)
        else
          merge_values_into_array(oldval, newval)
        end
      end
    end
Private