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]]