@@ -3590,21 +3590,22 @@ rb_hash_to_h_block(VALUE hash)
35903590
35913591/*
35923592 * call-seq:
3593- * to_h -> self or new_hash
35943593 * to_h {|key, value| ... } -> new_hash
3594+ * to_h -> self or new_hash
35953595 *
3596- * For an instance of +Hash+ , returns +self+.
3597- *
3598- * For a subclass of +Hash+, returns a new +Hash+
3599- * containing the content of +self+.
3596+ * With a block given , returns a new hash whose content is based on the block;
3597+ * the block is called with each entry's key and value;
3598+ * the block should return a 2-element array
3599+ * containing the key and value to be included in the returned array:
36003600 *
3601- * When a block is given, returns a new +Hash+ object
3602- * whose content is based on the block;
3603- * the block should return a 2-element Array object
3604- * specifying the key-value pair to be included in the returned Array:
36053601 * h = {foo: 0, bar: 1, baz: 2}
3606- * h1 = h.to_h {|key, value| [value, key] }
3607- * h1 # => {0=>:foo, 1=>:bar, 2=>:baz}
3602+ * h.to_h {|key, value| [value, key] }
3603+ * # => {0 => :foo, 1 => :bar, 2 => :baz}
3604+ *
3605+ * With no block given, returns +self+ if +self+ is an instance of +Hash+;
3606+ * if +self+ is a subclass of +Hash+, returns a new hash containing the content of +self+.
3607+ *
3608+ * Related: see {Methods for Converting}[rdoc-ref:Hash@Methods+for+Converting].
36083609 */
36093610
36103611static VALUE
0 commit comments