class Lowkiq::Utils::Array

Public Class Methods

new(array) click to toggle source
# File lib/lowkiq/utils.rb, line 4
def initialize(array)
  @array = array.to_a
end

Public Instance Methods

in_transposed_groups(number) click to toggle source
# File lib/lowkiq/utils.rb, line 8
def in_transposed_groups(number)
  result = number.times.map { [] }

  @array.each_with_index do |item, index|
    group = index % number
    result[group] << item
  end

  result
end