Skip to content

Commit 50e11e9

Browse files
committed
Simplify Array#in_groups_of code
1 parent f660abc commit 50e11e9

File tree

1 file changed

+1
-3
lines changed
  • activesupport/lib/active_support/core_ext/array

1 file changed

+1
-3
lines changed

activesupport/lib/active_support/core_ext/array/grouping.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ def in_groups_of(number, fill_with = nil)
3131
if block_given?
3232
collection.each_slice(number) { |slice| yield(slice) }
3333
else
34-
groups = []
35-
collection.each_slice(number) { |group| groups << group }
36-
groups
34+
collection.each_slice(number).to_a
3735
end
3836
end
3937

0 commit comments

Comments
 (0)