aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2013-11-10 22:47:31 -0800
committerGuillermo Iguaran <guilleiguaran@gmail.com>2013-11-10 22:47:31 -0800
commit5b1221347d371464fbf69900deef251a9c07fbe9 (patch)
tree55bc60d393cee93e762c8bd0199ed15234e70aac /activesupport/lib
parentb72304f41ed33c266189973c7e8869124fbc2130 (diff)
parent133399482c12820c6c96c5e0e6697cdcc0f158e3 (diff)
downloadrails-5b1221347d371464fbf69900deef251a9c07fbe9.tar.gz
rails-5b1221347d371464fbf69900deef251a9c07fbe9.tar.bz2
rails-5b1221347d371464fbf69900deef251a9c07fbe9.zip
Merge pull request #12839 from kuldeepaggarwal/array_split
Array#split preserving the calling array
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/array/grouping.rb4
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 << []