From 13d2696c10726afecd393753fcac88c5a9907d8c Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Wed, 29 Jan 2014 15:42:07 -0500 Subject: Return sized enumerator from Batches#find_each --- activesupport/lib/active_support/core_ext/enumerable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext/enumerable.rb') diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 4501b7ff58..a2dec41c87 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -35,7 +35,7 @@ module Enumerable if block_given? Hash[map { |elem| [yield(elem), elem] }] else - to_enum :index_by + to_enum(:index_by) { size } end end -- cgit v1.2.3 From a476020567a47f5fbec3629707d5bf31b400a284 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Tue, 4 Feb 2014 02:18:03 -0500 Subject: Return sized enumerator from Enumerable#index_by --- activesupport/lib/active_support/core_ext/enumerable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext/enumerable.rb') diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index a2dec41c87..1343beb87a 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -35,7 +35,7 @@ module Enumerable if block_given? Hash[map { |elem| [yield(elem), elem] }] else - to_enum(:index_by) { size } + to_enum(:index_by) { size if respond_to?(:size) } end end -- cgit v1.2.3