# File lib/active_support/core_ext/array/grouping.rb, line 23 def in_groups_of(number, fill_with = nil, &block) require 'enumerator' collection = dup collection << fill_with until collection.size.modulo(number).zero? unless fill_with == false grouped_collection = [] unless block_given? collection.each_slice(number) do |group| block_given? ? yield(group) : grouped_collection << group end grouped_collection unless block_given? end