Sha256: f49595911a77a7c7300e4a4300671a314a796e3c5adceb012af569d4d9b9de54
Contents?: true
Size: 410 Bytes
Versions: 54
Compression:
Stored size: 410 Bytes
Contents
class ArrayUtil def self.to_columns(arr) " #{StringUtil.backward_truncate(arr[0])} | #{arr[1]} #{arr[2]}\n" end def self.chunk(arr, pieces=2) len = arr.length; mid = (len/pieces) chunks = [] start = 0 1.upto(pieces) do |i| last = start+mid last = last-1 unless len%pieces >= i chunks << arr[start..last] || [] start = last+1 end chunks end end
Version data entries
54 entries across 54 versions & 1 rubygems