Subject: Grouping an array into sub-arrays.
From: Intransition <transfire gmail.com>
Date: Wed, 7 Sep 2011 07:47:06 +0900
Is there a method out there already that does anything like this?
[0,1,2,3,4].group(0..-2, -1) #=> [[0,1,2,3]. [4]]
[0,1,2,3,4].group(0, 2..3, 4..-1) #=> [[0], [2,3], [4]]