Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use faster Array.new instead of []*padding

  • Loading branch information...
commit 6fa575bb4f744315470cc971804dd6d09b5b987f 1 parent 630d2e4
@vipulnsward vipulnsward authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/core_ext/array/grouping.rb
View
2  activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -25,7 +25,7 @@ def in_groups_of(number, fill_with = nil)
# subtracting from number gives how many to add;
# modulo number ensures we don't add group of just fill.
padding = (number - size % number) % number
- collection = dup.concat([fill_with] * padding)
+ collection = dup.concat(Array.new(padding, fill_with))
end
if block_given?
Please sign in to comment.
Something went wrong with that request. Please try again.