aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2012-11-16 03:35:42 -0500
committerMarc-Andre Lafortune <github@marc-andre.ca>2012-11-16 03:35:42 -0500
commit3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf (patch)
tree0d0fad217d331870bab56fcfcbc6499a725d5111 /activesupport/lib/active_support
parent22edb664cf081485e4e37bf5a797890648126a79 (diff)
downloadrails-3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf.tar.gz
rails-3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf.tar.bz2
rails-3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf.zip
Simplify (and optimize)
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/array/grouping.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/grouping.rb b/activesupport/lib/active_support/core_ext/array/grouping.rb
index 97a25cd2e6..640e6e9328 100644
--- a/activesupport/lib/active_support/core_ext/array/grouping.rb
+++ b/activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -67,9 +67,9 @@ class Array
number.times do |index|
length = division + (modulo > 0 && modulo > index ? 1 : 0)
- padding = fill_with != false &&
- modulo > 0 && length == division ? 1 : 0
- groups << slice(start, length).concat([fill_with] * padding)
+ groups << last_group = slice(start, length)
+ last_group << fill_with if fill_with != false &&
+ modulo > 0 && length == division
start += length
end