Project

General

Profile

Actions

Bug #10536

closed

RubyDoc example for Enumerable#map incorrect

Added by eebbesen (Eric Ebbesen) over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
2.0, 2.1.0
[ruby-core:66415]

Description

collect is shown in the example section instead of map

This is fully the case for the 2.0 doc (http://ruby-doc.org/core-2.0/Enumerable.html#method-i-map) and partially the case for the 2.1 doc (http://ruby-doc.org/core-2.1.0/Enumerable.html#method-i-map).

For example, from http://ruby-doc.org/core-2.1.0/Enumerable.html#method-i-map:

(1..4).map { |i| i*i }      #=> [1, 4, 9, 16]
(1..4).collect { "cat"  }   #=> ["cat", "cat", "cat", "cat"]

Updated by eebbesen (Eric Ebbesen) over 9 years ago

collect is shown in the example section instead of map

This is fully the case for the 2.0 doc (http://ruby-doc.org/core-2.0/Enumerable.html#method-i-map) and partially the case for the 2.1 doc (http://ruby-doc.org/core-2.1.0/Enumerable.html#method-i-map).

For example, from http://ruby-doc.org/core-2.1.0/Enumerable.html#method-i-map (partial one):

(1..4).map { |i| i*i }      #=> [1, 4, 9, 16]
(1..4).collect { "cat"  }   #=> ["cat", "cat", "cat", "cat"]

Updated by stomar (Marcus Stollsteimer) over 9 years ago

That's intentional, both methods are aliases (note that the documentation for #collect and #map is the same).

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0