search for: new_collect

Displaying 1 result from an estimated 1 matches for "new_collect".

2008 Jan 01
7
in_vertical_groups_of
...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 != false ? fill_with : nil)) end end return new...