Actions
Bug #10944
closedDocumentation of Array.new w.r.t. element index available to a block
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p353 (2013-11-22 revision 43784) [i386-linux]
Backport:
Description
In http://ruby-doc.org/core-2.2.1/Array.html#class-Array-label-Creating+Arrays
The documentation for the Array.new method is missing the fact that the element index is available to a given block.
E.g.
Array.new(4) { |x| x } #=> [0, 1, 2, 3]
Updated by cremno (cremno phobia) almost 10 years ago
The actual Array.new
documentation mentions and also provides an example for this:
http://ruby-doc.org/core-2.2.1/Array.html#method-c-new (second code block)
Updated by stomar (Marcus Stollsteimer) almost 8 years ago
Although it's already documented in Array.new, an additional example in the class documentation cannot hurt; so I'll add one.
Updated by stomar (Marcus Stollsteimer) almost 8 years ago
- Status changed from Open to Closed
Applied in changeset r58037.
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]
Updated by usa (Usaku NAKAMURA) almost 8 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED
Updated by usa (Usaku NAKAMURA) over 7 years ago
- Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONE, 2.3: REQUIRED, 2.4: REQUIRED
ruby_2_2 r58129 merged revision(s) 58037.
Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago
- Backport changed from 2.2: DONE, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONE, 2.3: DONE, 2.4: REQUIRED
ruby_2_3 r58163 merged revision(s) 58037.
Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago
- Backport changed from 2.2: DONE, 2.3: DONE, 2.4: REQUIRED to 2.2: DONE, 2.3: DONE, 2.4: DONE
ruby_2_4 r58629 merged revision(s) 58037.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0