Actions
Bug #6157
closedEnumerable::Lazy#select does not handle multiple yield arguments
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-03-15 trunk 35028) [x86_64-darwin11.3.0]
Backport:
Description
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]]
Updated by shugo (Shugo Maeda) almost 13 years ago
- 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.
Actions
Like0
Like0