Sha256: a6f3cb82445cd279b14b632265b8a1c810095f5399b85a63ea60d9127040e75e
Contents?: true
Size: 408 Bytes
Versions: 2
Compression:
Stored size: 408 Bytes
Contents
class ArrayUtil def self.to_columns(arr) " #{StringUtil.backward_truncate(arr[0])} | #{arr[1]} #{arr[2]}" 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
web_translate_it-1.8.2.2 | lib/web_translate_it/util/array_util.rb |
web_translate_it-1.8.2.1 | lib/web_translate_it/util/array_util.rb |