Project

General

Profile

Actions

Bug #15613

closed

Enumerator::Chain#each doesn't relay block signature

Added by marcandre (Marc-Andre Lafortune) about 5 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
[ruby-core:91600]

Description

Currently, the block given when iterating on the components of a Enumerator::Chain always have arity of -1 and lambda? is always false:

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.


Files

enum-chain-lambda-15613.patch (2.02 KB) enum-chain-lambda-15613.patch jeremyevans0 (Jeremy Evans), 08/28/2019 11:45 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0