class Hash
  def + right 
    right.dup.update(self)
  end
  def - right
    self.reject{|key,value| right.has_key? key}
  end
end

h1 = { 1 => 2 , 2 => 3 }
h2 = { 2 => 3 , 3 => 4 }
h3 = { 1 => 3 , 3 => 5 }

p h1,h2,h3  ## {1=>2, 2=>3}{2=>3, 3=>4}{1=>3, 3=>5}
p h1+h2     ## {1=>2, 2=>3, 3=>4}
p h1+h3     ## {1=>2, 2=>3, 3=>5}
p h3+h1     ## {1=>3, 2=>3, 3=>5}
p h1-h2     ## {1=>2}
p h1-h3     ## {2=>3}

p ( (h1+h3) - (h3-h1) )  ## {1=>2, 2=>3} == h1

Take_tk = KUMAGAI Hidetake
たけ(tk)=熊谷秀武