Permalink
Browse files

Simplify Array#in_groups_of code

  • Loading branch information...
1 parent f660abc commit 50e11e989727b6886b25d61333ce40060514c3e2 @amatsuda amatsuda committed Jul 10, 2013
Showing with 1 addition and 3 deletions.
  1. +1 −3 activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -31,9 +31,7 @@ def in_groups_of(number, fill_with = nil)
if block_given?
collection.each_slice(number) { |slice| yield(slice) }
else
- groups = []
- collection.each_slice(number) { |group| groups << group }
- groups
+ collection.each_slice(number).to_a
end
end

0 comments on commit 50e11e9

Please sign in to comment.