[前][次][番号順一覧][スレッド一覧]

ruby-changes:46730

From: rhe <ko1@a...>
Date: Mon, 22 May 2017 16:13:11 +0900 (JST)
Subject: [ruby-changes:46730] rhe:r58845 (trunk): hash.c: [DOC] fix docs for Hash#transform_values!

rhe	2017-05-22 16:13:06 +0900 (Mon, 22 May 2017)

  New Revision: 58845

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58845

  Log:
    hash.c: [DOC] fix docs for Hash#transform_values!
    
    Hash#transform_values! returns the receiver rather than a new Hash
    object.

  Modified files:
    trunk/hash.c
Index: hash.c
===================================================================
--- hash.c	(revision 58844)
+++ hash.c	(revision 58845)
@@ -1839,14 +1839,15 @@ rb_hash_transform_values(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L1839
  *     hsh.transform_values! {|value| block } -> hsh
  *     hsh.transform_values!                  -> an_enumerator
  *
- *  Return a new hash with the results of running block once for every value.
+ *  Invokes the given block once for each value in <i>hsh</i>, replacing it
+ *  with the new value returned by the block, and then returns <i>hsh</i>.
  *  This method does not change the keys.
  *
  *     h = { a: 1, b: 2, c: 3 }
  *     h.transform_values! {|v| v * v + 1 }  #=> { a: 2, b: 5, c: 10 }
- *     h.transform_values!(&:to_s)           #=> { a: "1", b: "2", c: "3" }
+ *     h.transform_values!(&:to_s)           #=> { a: "2", b: "5", c: "10" }
  *     h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
- *                                           #=> { a: "1.0", b: "2.1", c: "3.2" }
+ *                                           #=> { a: "1.0", b: "5.1", c: "10.2" }
  *
  *  If no block is given, an enumerator is returned instead.
  */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]