Displaying 1 result from an estimated 1 matches for "per_column".
Did you mean:
user_column
2008 Jan 01
7
in_vertical_groups_of
...n 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 << (offset < collection.size ? collection
[offset] : (fill_with != fals...