Issue #15613 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #15613: Enumerator::Chain#each doesn't relay block signature
https://bugs.ruby-lang.org/issues/15613

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: 2.6.1
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently, the block given when iterating on the components of a `Enumerator::Chain` always have arity of -1 and `lambda?` is always `false`:

```ruby
class Foo
  include Enumerable
  def each(&block)
    return to_enum unless block
    p block.arity, block.lambda?
  end
end
foo = Foo.new

foo.each(&->{}) # => 0, true
foo.each.each(&->{}) # => 0, true
foo.chain.each(&->{}) # => -1, false. Would ideally be 0, true
```

It would be preferable if the block information wasn't lost.



-- 
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>