
class Hash

  # Operator for merge.

  def +(other)
    merge(other)
  end

  # Operator for remove hash paris. If another hash is given
  # the pairs are only removed if both key and value are equal.
  # If an array is given then mathcing keys are removed.

  def -(other)
    h = self.dup
    if other.respond_to?(:to_ary)
      other.to_ary.each do |k|
        h.delete(k)
      end
    else
      other.each do |k,v|
        if h.key?(k)
          h.delete(k) if value == h[k]
        end
      end
    end
  end

end
