@@ -1715,7 +1715,7 @@ rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
1715
1715
* hsh.update(other_hash){|key, oldval, newval| block} => hsh
1716
1716
*
1717
1717
* Adds the contents of <i>other_hash</i> to <i>hsh</i>. If no
1718
- * block is specified entries with duplicate keys are overwritten
1718
+ * block is specified, entries with duplicate keys are overwritten
1719
1719
* with the values from <i>other_hash</i>, otherwise the value
1720
1720
* of each duplicate key is determined by calling the block with
1721
1721
* the key, its value in <i>hsh</i> and its value in <i>other_hash</i>.
@@ -1750,12 +1750,16 @@ rb_hash_update(VALUE hash1, VALUE hash2)
1750
1750
* hsh.merge(other_hash){|key, oldval, newval| block} -> a_hash
1751
1751
*
1752
1752
* Returns a new hash containing the contents of <i>other_hash</i> and
1753
- * the contents of <i>hsh</i>, overwriting entries in <i>hsh</i> with
1754
- * duplicate keys with those from <i>other_hash</i>.
1753
+ * the contents of <i>hsh</i>. If no block is specified, the value for
1754
+ * entries with duplicate keys will be that of <i>other_hash</i>. Otherwise
1755
+ * the value for each duplicate key is determined by calling the block
1756
+ * with the key, its value in <i>hsh</i> and its value in <i>other_hash</i>.
1755
1757
*
1756
1758
* h1 = { "a" => 100, "b" => 200 }
1757
1759
* h2 = { "b" => 254, "c" => 300 }
1758
1760
* h1.merge(h2) #=> {"a"=>100, "b"=>254, "c"=>300}
1761
+ * h1.merge(h2){|key, oldval, newval| newval - oldval}
1762
+ * #=> {"a"=>100, "b"=>54, "c"=>300}
1759
1763
* h1 #=> {"a"=>100, "b"=>200}
1760
1764
*
1761
1765
*/
0 commit comments