Actions
Bug #12029
closedNot all elements are yielded when count is given a block
Description
When count is called on an enumerable that yields multiple elements, not all elements are yielded to the block.
def foo
yield 1, 2
end
to_enum(:foo).count { |e| e == [1, 2] }
# Returns: 0
# Expected: 1
It appears that only the first element is yielded:
to_enum(:foo).count { |e| p e; e == [1, 2] }
# Prints 1
Actions
Like0
Like0Like0Like0