aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/enumerable.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-05 20:10:45 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-05 20:10:45 -0200
commit84fe7b7db64352c0186a9d2a51f4eb32d2825d2a (patch)
tree49ab417231c91102b3b878aaaf10285f1a465785 /activesupport/lib/active_support/core_ext/enumerable.rb
parent1df4dcf7dd9ec5cf8fed3c04d9427ad925f2b83b (diff)
parenta476020567a47f5fbec3629707d5bf31b400a284 (diff)
downloadrails-84fe7b7db64352c0186a9d2a51f4eb32d2825d2a.tar.gz
rails-84fe7b7db64352c0186a9d2a51f4eb32d2825d2a.tar.bz2
rails-84fe7b7db64352c0186a9d2a51f4eb32d2825d2a.zip
Merge pull request #13938 from marcandre/sized_enumerator
Sized enumerator
Diffstat (limited to 'activesupport/lib/active_support/core_ext/enumerable.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index 4501b7ff58..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
+ to_enum(:index_by) { size if respond_to?(:size) }
end
end