Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify (and optimize)

  • Loading branch information...
commit 3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf 1 parent 22edb66
@marcandre marcandre authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 activesupport/lib/active_support/core_ext/array/grouping.rb
View
6 activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -67,9 +67,9 @@ def in_groups(number, fill_with = nil)
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
Please sign in to comment.
Something went wrong with that request. Please try again.