zip

enum.zip(arg, ...) â an_array_of_arrayenum.zip(arg, ...) { |arr| block } â nil Instance Public methods Takes one element from enum and merges corresponding elements from each args. This generates a sequence of n-element arrays, where n is one more than the count of arguments. The length of the resulting sequence will be enum#size. If the size of any argument is less than enum#size, nil values are supplied. If a block is given, it is invoked for each output arr

new

Lazy.new(obj, size=nil) { |yielder, *values| ... } Class Public methods Creates a new Lazy enumerator. When the enumerator is actually enumerated (e.g. by calling force), obj will be enumerated and each value passed to the given block. The block can yield values back using yielder. For example, to create a method filter_map in both lazy and non-lazy fashions: module Enumerable def filter_map(&block) map(&block).compact end end class Enumerator::Lazy def filter_m

chunk

chunk(*args) Instance Public methods

collect

collect() Instance Public methods

collect_concat

lazy.flat_map { |obj| block } â a_lazy_enumerator Instance Public methods Returns a new lazy enumerator with the concatenated results of running block once for every element in lazy. ["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"] A value x returned by block is decomposed if either of the following conditions is true: a) <i>x</i> responds to both each and force, which means that <i>x</i> is a lazy en

drop

drop(p1) Instance Public methods

drop_while

drop_while() Instance Public methods

enum_for

lzy.enum_for(method = :each, *args) â lazy_enumlzy.enum_for(method = :each, *args){|*args| block} â lazy_enum Instance Public methods Similar to Kernel#to_enum, except it returns a lazy enumerator. This makes it easy to define Enumerable methods that will naturally remain lazy if called from a lazy enumerator. For example, continuing from the example in Kernel#to_enum: # See Kernel#to_enum for the definition of repeat r = 1..Float::INFINITY r.repeat(2).first(5) # =&g

find_all

find_all() Instance Public methods

flat_map

lazy.flat_map { |obj| block } â a_lazy_enumerator Instance Public methods Returns a new lazy enumerator with the concatenated results of running block once for every element in lazy. ["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"] A value x returned by block is decomposed if either of the following conditions is true: a) <i>x</i> responds to both each and force, which means that <i>x</i> is a lazy enu