Actions
Misc #10469
closedDocumented return value for Array#each
Status:
Closed
Assignee:
Description
This is a minor documentation suggestion.
When given a block, Array#each
returns self
.
[1,2,3].each { |x| 'banana' }
#=> [1, 2, 3]
However, this is not obvious (to me) from the documentation.
The documented method signature is each { |item| block } → ary
. Perhaps most people would understand that ary
is self
, but I think it could be more clear.
Perhaps something like the following (change in bold):
Calls the given block once for each element in self, passing that element as a parameter, and returning the array itself.
Thanks!
Files
Updated by jaredbeck (Jared Beck) about 10 years ago
Here's a patch, if that helps.
Updated by hsbt (Hiroshi SHIBATA) almost 10 years ago
- Status changed from Open to Closed
Actions
Like0
Like0Like0