[#67346] Future of test suites for Ruby — Charles Oliver Nutter <headius@...>

I'll try to be brief so we can discuss all this. tl;dr: RubySpec is

19 messages 2015/01/05

[ruby-core:67542] [ruby-trunk - Misc #10469] [Closed] Documented return value for Array#each

From: shibata.hiroshi@...
Date: 2015-01-12 13:53:32 UTC
List: ruby-core #67542
Issue #10469 has been updated by Hiroshi SHIBATA.

Status changed from Open to Closed

----------------------------------------
Misc #10469: Documented return value for Array#each
https://bugs.ruby-lang.org/issues/10469#change-50955

* Author: Jared Beck
* Status: Closed
* Priority: Low
* Assignee: Zachary Scott
----------------------------------------
This is a minor documentation suggestion.

When given a block, `Array#each` returns `self`.

    [1,2,3].each { |x| 'banana' }
    #=3D> [1, 2, 3]

However, this is not obvious (to me) from the documentation.

The documented method signature is `each { |item| block } =E2=86=92 ary`.  =
Perhaps most people would understand that `ary` is `self`, but I think it c=
ould be more clear.

Perhaps something like the following (change in bold):

Calls the given block once for each element in self, passing that element a=
s a parameter, **and returning the array itself.**

Thanks!

---Files--------------------------------
array_each_return_docs.patch (927 Bytes)


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

In This Thread

Prev Next