D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Enumerable
/
Filename :
each_entry-i.ri
back
Copy
U:RDoc::AnyMethod[iI"each_entry:ETI"Enumerable#each_entry;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Calls the given block with each element, ;TI"Gconverting multiple values from yield to an array; returns +self+:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"a = [] ;TI">(1..4).each_entry {|element| a.push(element) } # => 1..4 ;TI"a # => [1, 2, 3, 4] ;TI" ;TI"a = [] ;TI"!h = {foo: 0, bar: 1, baz:2} ;TI"/h.each_entry {|element| a.push(element) } ;TI"&# => {:foo=>0, :bar=>1, :baz=>2} ;TI".a # => [[:foo, 0], [:bar, 1], [:baz, 2]] ;TI" ;TI"class Foo ;TI" include Enumerable ;TI" def each ;TI" yield 1 ;TI" yield 1, 2 ;TI" yield ;TI" end ;TI" end ;TI"/Foo.new.each_entry {|yielded| p yielded } ;T:@format0o; ; [I"Output:;T@o;; [I"1 ;TI"[1, 2] ;TI" nil ;T; 0o; ; [I"0With no block given, returns an Enumerator.;T: @fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"aeach_entry(*args) {|element| ... } -> self each_entry(*args) -> enumerator ;T0[ I"(*args);T@0FI"Enumerable;TcRDoc::NormalModule00