[ruby-core:80256] [Ruby trunk Bug#10944] Documentation of Array.new w.r.t. element index available to a block

From: sto.mar@...
Date: 2017-03-20 20:17:13 UTC
List: ruby-core #80256
Issue #10944 has been updated by stomar (Marcus Stollsteimer).


Although it's already documented in Array.new, an additional example in the class documentation cannot hurt; so I'll add one.

----------------------------------------
Bug #10944: Documentation of Array.new w.r.t. element index available to a block
https://bugs.ruby-lang.org/issues/10944#change-63693

* Author: dgc (Don Cruickshank)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i386-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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]




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next