diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2014-02-04 02:18:03 -0500 |
---|---|---|
committer | Marc-Andre Lafortune <github@marc-andre.ca> | 2014-02-05 16:53:58 -0500 |
commit | a476020567a47f5fbec3629707d5bf31b400a284 (patch) | |
tree | 49ab417231c91102b3b878aaaf10285f1a465785 /activesupport/lib/active_support | |
parent | 13d2696c10726afecd393753fcac88c5a9907d8c (diff) | |
download | rails-a476020567a47f5fbec3629707d5bf31b400a284.tar.gz rails-a476020567a47f5fbec3629707d5bf31b400a284.tar.bz2 rails-a476020567a47f5fbec3629707d5bf31b400a284.zip |
Return sized enumerator from Enumerable#index_by
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/enumerable.rb | 2 |
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 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 |