diff options
author | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 07:13:06 +0000 |
---|---|---|
committer | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 07:13:06 +0000 |
commit | 5565fed887e8a1a4d389f59a5de1000fec99ca2e (patch) | |
tree | b9d38f60f27b44d5d08f052a093655b4cf27cd56 /hash.c | |
parent | 27fb27ff428f94060533a12efa5a71fba55f1649 (diff) | |
download | bundler-5565fed887e8a1a4d389f59a5de1000fec99ca2e.tar.gz |
hash.c: [DOC] fix docs for Hash#transform_values!
Hash#transform_values! returns the receiver rather than a new Hash
object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1839,14 +1839,15 @@ rb_hash_transform_values(VALUE hash) * 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. */ |