diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index f2dd34cc55afc9b6f0b4c81a4eb71baf6d164070..ddb4f3012fcac77b543b9fd5b13d1e24c071fe5e 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -76,10 +76,10 @@ def sum(identity = 0, &block) # # (1..5).each_with_object(1) { |value, memo| memo *= value } # => 1 # - def each_with_object(memo, &block) + def each_with_object(memo) return to_enum :each_with_object, memo unless block_given? each do |element| - block.call(element, memo) + yield element, memo end memo end unless [].respond_to?(:each_with_object)