I finally reach out to my goal,which is


h1 = {:url_id => 1, :used => 10}
h2 = {:url_id => 1, :used => 5}
h3 = h1.update(h2) do |k,old,new|
 if k == :used
  old+new
 else
  old
 end
end
h3
# => {:url_id=>1, :used=>15}

-- 
Posted via http://www.ruby-forum.com/.