Issue #6157 has been updated by Shugo Maeda.

Status changed from Open to Closed

Dan Kubb wrote:
> When the #each method yields more than one argument, Enumerable::Lazy#select only accepts the first argument, e.g.:

The bug has already been fixed in r35043.  Please try the latest revision.

----------------------------------------
Bug #6157: Enumerable::Lazy#select does not handle multiple yield arguments
https://bugs.ruby-lang.org/issues/6157#change-24646

Author: Dan Kubb
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2012-03-15 trunk 35028) [x86_64-darwin11.3.0]


When the #each method yields more than one argument, Enumerable::Lazy#select only accepts the first argument, e.g.:

  class MultiYield                                                               
    include Enumerable                                                           
    def each                                                                     
      yield 1, 2, 3                                                              
    end                                                                          
  end                                                                            
                                                                                 
  multi = MultiYield.new                                                         
  multi.lazy.select { |e| e == [1, 2, 3] }.to_a  # => []

The above code will not match. "e" will be equal to 1, rather than [1, 2, 3].

For reference, here is the non-lazy version, which matches the expected values:

  multi = MultiYield.new
  multi.select { |e| e == [1, 2, 3] }.to_a  # => [[1, 2, 3]]


-- 
http://bugs.ruby-lang.org/