class Array # # TODO # active_supportに同様のメソッドが無いかどうかの確認 # def split_by(num) return [] if self.size < 1 ret = [[]] counter = 0 self.each do |val| (counter = 0;ret << []) if counter >= num ret[-1] << val counter += 1 end return ret end end