0.0
No release in over 3 years
Low commit activity in last 3 years
[1,2,3,4,5].in_groups(2) => [ [1,2,3], [4,5] ] ------------------------------------------------------- [1,2,3,4,5].in_groups_of(2) => [ [1,2], [3,4], [5] ] ------------------------------------------------------- [1,2,3,4,5].in_groups_of(2, nil_fill: true) => [ [1,2], [3,4], [5,nil] ] ------------------------------------------------------- This allows the grouping of an array into different "groups". Great for threading long arrays by group or making them rectangular.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Array Groups

https://rubygems.org/gems/array_groups

This gem allows the use of Array#in_groups and Array#in_groups_of to be used outside of rails.

Pretty self-explanatory, but here are some examples.

[1, 2, 3, 4, 5].in_groups(2)
  [ [1,2,3], [4,5] ]

[1, 2, 3, 4, 5].in_groups_of(2)
  [ [1,2], [3,4], [5] ]

[1, 2, 3, 4, 5].in_groups_of(2, nil_fill: true)
  [ [1,2], [3,4], [5,nil] ]