| Server IP : 162.214.74.102 / Your IP : 216.73.217.46 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Enumerator/ |
Upload File : |
U:RDoc::AnyMethod[iI"new:ETI"Enumerator::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Creates a new Enumerator object, which can be used as an ;TI"Enumerable.;To:RDoc::Markup::BlankLine o;
; [I"DIn the first form, iteration is defined by the given block, in ;TI"Hwhich a "yielder" object, given as block parameter, can be used to ;TI"Cyield a value by calling the +yield+ method (aliased as +<<+):;T@o:RDoc::Markup::Verbatim; [I"!fib = Enumerator.new do |y|
;TI" a = b = 1
;TI" loop do
;TI" y << a
;TI" a, b = b, a + b
;TI" end
;TI" end
;TI"
;TI"<p fib.take(10) # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
;T:@format0o;
; [I"MThe optional parameter can be used to specify how to calculate the size ;TI"Jin a lazy fashion (see Enumerator#size). It can either be a value or ;TI"a callable object.;T@o;
; [I"OIn the second, deprecated, form, a generated Enumerator iterates over the ;TI"Igiven object using the given method with the given arguments passed.;T@o;
; [I"MUse of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum ;TI"
instead.;T@o;; [ I"3e = Enumerator.new(ObjectSpace, :each_object)
;TI"0 #-> ObjectSpace.enum_for(:each_object)
;TI"
;TI"Be.select { |obj| obj.is_a?(Class) } #=> array of all classes;T;
0:
@fileI"enumerator.c;T:0@omit_headings_from_table_of_contents_below0I"]Enumerator.new(size = nil) { |yielder| ... }
Enumerator.new(obj, method = :each, *args)
;T0[ I"(*args);T@3FI"Enumerator;TcRDoc::NormalClass00