Sha256: 758a4616873138a9ff9c916560e60b81c9c5ed236c21672b09ef3f43b6f9dbe5
Contents?: true
Size: 399 Bytes
Versions: 1
Compression:
Stored size: 399 Bytes
Contents
module HyperIterator def each_slice!(slice_size) if slice_size.nil? || !slice_size.is_a?(Integer) || slice_size <= 0 raise ArgumentError, "invalid slice size" end i = 0 while count > 0 current_slice = [] while i < slice_size && count > 0 current_slice << shift i += 1 end yield current_slice i = 0 end nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper_iterator-0.3.1 | lib/iterators/each_slice_bang.rb |