Repository URL to install this package:
|
Version:
2.2.2-1 ▾
|
U:RDoc::AnyMethod[iI"to_enum:ETI"Enumerator::Lazy#to_enum;TF:publico:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"ESimilar to Kernel#to_enum, except it returns a lazy enumerator. ;TI"?This makes it easy to define Enumerable methods that will ;TI"<naturally remain lazy if called from a lazy enumerator.;To:RDoc::Markup::BlankLine o;
; [I"@For example, continuing from the example in Kernel#to_enum:;T@o:RDoc::Markup::Verbatim; [
I"7# See Kernel#to_enum for the definition of repeat
;TI"r = 1..Float::INFINITY
;TI"/r.repeat(2).first(5) # => [1, 1, 2, 2, 3]
;TI"'r.repeat(2).class # => Enumerator
;TI"=r.repeat(2).map{|n| n ** 2}.first(5) # => endless loop!
;TI"+# works naturally on lazy enumerator:
;TI"2r.lazy.repeat(2).class # => Enumerator::Lazy
;TI"Cr.lazy.repeat(2).map{|n| n ** 2}.first(5) # => [1, 1, 4, 4, 9];T:@format0:
@fileI"enumerator.c;T:0@omit_headings_from_table_of_contents_below0I"lzy.to_enum(method = :each, *args) -> lazy_enum
lzy.to_enum(method = :each, *args) {|*args| block} -> lazy_enum;T0[ I"(*args);T@FI" Lazy;TcRDoc::NormalClass00