diff options
author | KD <kd.engineer@yahoo.co.in> | 2013-11-11 11:32:30 +0530 |
---|---|---|
committer | KD <kd.engineer@yahoo.co.in> | 2013-11-11 11:32:30 +0530 |
commit | 133399482c12820c6c96c5e0e6697cdcc0f158e3 (patch) | |
tree | 7ba8809ec749e52023741277930b56c1efc7ac8a /activesupport/lib | |
parent | 140c0c8881d100b0d0bc2a0bce1227ddfbd9c9bd (diff) | |
download | rails-133399482c12820c6c96c5e0e6697cdcc0f158e3.tar.gz rails-133399482c12820c6c96c5e0e6697cdcc0f158e3.tar.bz2 rails-133399482c12820c6c96c5e0e6697cdcc0f158e3.zip |
Array#split preserving the calling array
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/grouping.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/grouping.rb b/activesupport/lib/active_support/core_ext/array/grouping.rb index 37f007c751..c0d6e5b70c 100644 --- a/activesupport/lib/active_support/core_ext/array/grouping.rb +++ b/activesupport/lib/active_support/core_ext/array/grouping.rb @@ -95,9 +95,9 @@ class Array results end else - results, arr = [[]], self + results, arr = [[]], self.dup until arr.empty? - if (idx = index(value)) + if (idx = arr.index(value)) results.last.concat(arr.shift(idx)) arr.shift results << [] |