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

ruby-changes:45966

From: stomar <ko1@a...>
Date: Tue, 21 Mar 2017 05:30:30 +0900 (JST)
Subject: [ruby-changes:45966] stomar:r58037 (trunk): docs for creating arrays

stomar	2017-03-21 05:30:25 +0900 (Tue, 21 Mar 2017)

  New Revision: 58037

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

  Log:
    docs for creating arrays
    
    * array.c: [DOC] add example for Array.new with block and index.
      Reported by Don Cruickshank.  [ruby-core:68442] [Bug #10944]

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 58036)
+++ array.c	(revision 58037)
@@ -5926,7 +5926,8 @@ rb_ary_sum(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L5926
  *  This method is safe to use with mutable objects such as hashes, strings or
  *  other arrays:
  *
- *     Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
+ *     Array.new(4) { Hash.new }  #=> [{}, {}, {}, {}]
+ *     Array.new(4) {|i| i.to_s } #=> ["0", "1", "2", "3"]
  *
  *  This is also a quick way to build up multi-dimensional arrays:
  *

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

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