D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Enumerable
/
Filename :
to_h-i.ri
back
Copy
U:RDoc::AnyMethod[iI" to_h:ETI"Enumerable#to_h;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"/When +self+ consists of 2-element arrays, ;TI"@returns a hash each of whose entries is the key-value pair ;TI"%formed from one of those arrays:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"M[[:foo, 0], [:bar, 1], [:baz, 2]].to_h # => {:foo=>0, :bar=>1, :baz=>2} ;T:@format0o; ; [I"MWhen a block is given, the block is called with each element of +self+; ;TI"Nthe block should return a 2-element array which becomes a key-value pair ;TI"in the returned hash:;T@o;; [I"A(0..3).to_h {|i| [i, i ** 2]} # => {0=>0, 1=>1, 2=>4, 3=>9} ;T; 0o; ; [I"KRaises an exception if an element of +self+ is not a 2-element array, ;TI"and a block is not passed.;T: @fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"?to_h(*args) -> hash to_h(*args) {|element| ... } -> hash ;T0[ I"(*args);T@ FI"Enumerable;TcRDoc::NormalModule00