Displaying 1 result from an estimated 1 matches for "in_vertical_group".
Did you mean:
in_vertical_groups
2008 Jan 01
7
in_vertical_groups_of
...4 5 6
7
I thought this was pretty cool, but wanted to go vertically down the
column first, instead of horizontally
1 4 7
2 5
3 6
Well, last night I decided I really needed this vertical grouping,
so ...
module ActiveSupport
module CoreExtensions
module Array
module Grouping
def in_vertical_groups_of(number, fill_with = nil, &block)
collection = dup
per_column = (collection.size.to_f / number).ceil
new_collection = []
(0...per_column).each do |i|
(0...number).each do |multiplier|
offset = i + (per_column * multiplier)
new_collection &l...