From: nobu@... Date: 2016-01-28T16:14:13+00:00 Subject: [ruby-core:73554] [Ruby trunk - Bug #12029] [Rejected] Not all elements are yielded when count is given a block Issue #12029 has been updated by Nobuyoshi Nakada. Description updated Status changed from Open to Rejected ---------------------------------------- Bug #12029: Not all elements are yielded when count is given a block https://bugs.ruby-lang.org/issues/12029#change-56764 * Author: Jason Yeo * Status: Rejected * Priority: Normal * Assignee: * ruby -v: 2.3.0 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- 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 ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: