Skip to content

Commit

Permalink
Merge pull request #10413 from vipulnsward/change_grouping
Browse files Browse the repository at this point in the history
Use faster Array.new instead of []*padding
  • Loading branch information
carlosantoniodasilva committed May 3, 2013
2 parents 30f297b + 6fa575b commit 84139ba
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -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?
Expand Down

0 comments on commit 84139ba

Please sign in to comment.