Bug #12029
Updated by nobu (Nobuyoshi Nakada) over 8 years ago
When count is called on an enumerable that yields multiple elements, not all elements are yielded to the block. ~~~ruby ~~~ 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: ~~~ruby ~~~ to_enum(:foo).count { |e| p e; e == [1, 2] } # Prints 1 ~~~