⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
2.7.0
/
system
/
Enumerator
/
View File Name :
produce-c.ri
U:RDoc::AnyMethod[iI"produce:ETI"Enumerator::produce;TT:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"ICreates an infinite enumerator from any block, just called over and ;TI"Lover. The result of the previous iteration is passed to the next one. ;TI"HIf +initial+ is provided, it is passed to the first iteration, and ;TI"Ibecomes the first element of the enumerator; if it is not provided, ;TI"Jthe first iteration receives +nil+, and its result becomes the first ;TI"element of the iterator.;To:RDoc::Markup::BlankLine o; ; [I"=Raising StopIteration from the block stops an iteration.;T@o:RDoc::Markup::Verbatim; [I"IEnumerator.produce(1, &:succ) # => enumerator of 1, 2, 3, 4, .... ;TI" ;TI"JEnumerator.produce { rand(10) } # => infinite random number sequence ;TI" ;TI"_ancestors = Enumerator.produce(node) { |prev| node = prev.parent or raise StopIteration } ;TI"Cenclosing_section = ancestors.find { |n| n.type == :section } ;T:@format0o; ; [I"NUsing ::produce together with Enumerable methods like Enumerable#detect, ;TI"WEnumerable#slice, Enumerable#take_while can provide Enumerator-based alternatives ;TI"$for +while+ and +until+ cycles:;T@o;; [I"# Find next Tuesday ;TI"require "date" ;TI"?Enumerator.produce(Date.today, &:succ).detect(&:tuesday?) ;TI" ;TI"# Simple lexer: ;TI"require "strscan" ;TI"+scanner = StringScanner.new("7+38/6") ;TI"PATTERN = %r{\d+|[-/+*]} ;TI"UEnumerator.produce { scanner.scan(PATTERN) }.slice_after { scanner.eos? }.first ;TI"$# => ["7", "+", "38", "/", "6"];T; 0: @fileI"enumerator.c;T:0@omit_headings_from_table_of_contents_below0I"FEnumerator.produce(initial = nil) { |prev| block } -> enumerator ;T0[ I"(p1 = v1);T@0FI"Enumerator;TcRDoc::NormalClass00