module HyperIterator
Constants
- AVAILABLE_METHODS
- VERSION
Public Class Methods
each!(iterable) { |el| ... }
click to toggle source
# File lib/hyper_iterator.rb, line 11 def self.each!(iterable) iterable.each! { |el| yield el } end
Public Instance Methods
each_slice!(slice_size) { |current_slice| ... }
click to toggle source
# File lib/iterators/each_slice_bang.rb, line 2 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