Sha256: 1b9678bddd9c79ed33f72d454650442303997b9861922aba4c4000c90b4ece31
Contents?: true
Size: 687 Bytes
Versions: 5
Compression:
Stored size: 687 Bytes
Contents
=begin Arachni Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com> This is free software; you can copy and distribute and modify this program under the term of the GPL v2.0 License (See LICENSE file for details) =end class Array def chunk( pieces = 2 ) return self if pieces <= 0 len = self.length; mid = ( len / pieces ) chunks = [] start = 0 1.upto( pieces ) do |i| last = start + mid last = last - 1 unless len % pieces >= i chunks << self[ start..last ] || [] start = last + 1 end return chunks end end
Version data entries
5 entries across 5 versions & 1 rubygems