File: C:/Ruby27-x64/share/ri/2.7.0/system/Enumerator/feed-i.ri
U:RDoc::AnyMethod[iI" feed:ETI"Enumerator#feed;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"@Sets the value to be returned by the next yield inside +e+.;To:RDoc::Markup::BlankLine o;
; [I"4If the value is not set, the yield returns nil.;T@o;
; [I"/This value is cleared after being yielded.;T@o:RDoc::Markup::Verbatim; ['I"I# Array#map passes the array's elements to "yield" and collects the
;TI"'# results of "yield" as an array.
;TI"K# Following example shows that "next" returns the passed elements and
;TI"F# values passed to "feed" are collected as an array which can be
;TI")# obtained by StopIteration#result.
;TI"e = [1,2,3].map
;TI"p e.next #=> 1
;TI"e.feed "a"
;TI"p e.next #=> 2
;TI"e.feed "b"
;TI"p e.next #=> 3
;TI"e.feed "c"
;TI"begin
;TI" e.next
;TI"rescue StopIteration
;TI", p $!.result #=> ["a", "b", "c"]
;TI" end
;TI"
;TI"o = Object.new
;TI"def o.each
;TI"& x = yield # (2) blocks
;TI"( p x # (5) => "foo"
;TI"& x = yield # (6) blocks
;TI"& p x # (8) => nil
;TI"& x = yield # (9) blocks
;TI": p x # not reached w/o another e.next
;TI" end
;TI"
;TI"e = o.to_enum
;TI"e.next # (1)
;TI"e.feed "foo" # (3)
;TI"e.next # (4)
;TI"e.next # (7)
;TI" # (10);T:@format0:
@fileI"enumerator.c;T:0@omit_headings_from_table_of_contents_below0I"e.feed obj -> nil
;T0[ I" (p1);T@9FI"Enumerator;TcRDoc::NormalClass00