U:RDoc::AnyMethod[iI"slice_after:ETI"Enumerable#slice_after;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"6Creates an enumerator for each chunked elements. ;TI"?The ends of chunks are defined by _pattern_ and the block.;To:RDoc::Markup::BlankLine o;
; [I"PIf _pattern_ === _elt_
returns true
or the block ;TI"Hreturns true
for the element, the element is end of a ;TI"chunk.;T@o;
; [I"SThe ===
and _block_ is called from the first element to the last ;TI"element of _enum_.;T@o;
; [I"DThe result enumerator yields the chunked elements as an array. ;TI"/So +each+ method can be called as follows:;T@o:RDoc::Markup::Verbatim; [I"2enum.slice_after(pattern).each { |ary| ... }
;TI"8enum.slice_after { |elt| bool }.each { |ary| ... }
;T:@format0o;
; [I"BOther methods of the Enumerator class and Enumerable module, ;TI"*such as +map+, etc., are also usable.;T@o;
; [I"GFor example, continuation lines (lines end with backslash) can be ;TI"concatenated as follows:;T@o;; [I":lines = ["foo\n", "bar\\\n", "baz\n", "\n", "qux\n"]
;TI"*e = lines.slice_after(/(?#=> [["foo\n"], ["bar\\\n", "baz\n"], ["\n"], ["qux\n"]]
;TI"Np e.map {|ll| ll[0...-1].map {|l| l.sub(/\\\n\z/, "") }.join + ll.last }
;TI",#=>["foo\n", "barbaz\n", "\n", "qux\n"];T;
0:
@fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"genum.slice_after(pattern) -> an_enumerator
enum.slice_after { |elt| bool } -> an_enumerator
;T0[ I" (p1);T@1FI"Enumerable;TcRDoc::NormalModule00