Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/Hash/fetch-i.ri
Arrière
U:RDoc::AnyMethod[iI" fetch:ETI"Hash#fetch;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"JReturns a value from the hash for the given key. If the key can't be ;TI"Hfound, there are several options: With no other arguments, it will ;TI"Jraise a <code>KeyError</code> exception; if <i>default</i> is given, ;TI"Jthen that will be returned; if the optional code block is specified, ;TI"3then that will be run and its result returned.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"$h = { "a" => 100, "b" => 200 } ;TI"5h.fetch("a") #=> 100 ;TI";h.fetch("z", "go fish") #=> "go fish" ;TI">h.fetch("z") { |el| "go fish, #{el}"} #=> "go fish, z" ;T:@format0o; ; [I"HThe following example shows that an exception is raised if the key ;TI"6is not found and a default value is not supplied.;T@o;; [I"$h = { "a" => 100, "b" => 200 } ;TI"h.fetch("z") ;T; 0o; ; [I"<em>produces:</em>;T@o;; [I"4prog.rb:2:in `fetch': key not found (KeyError) ;TI" from prog.rb:2;T; 0: @fileI"hash.c;T:0@omit_headings_from_table_of_contents_below0I"Whsh.fetch(key [, default] ) -> obj hsh.fetch(key) {| key | block } -> obj ;T0[ I"(*args);T@(FI" Hash;TcRDoc::NormalClass00
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0 |
proxy
|
phpinfo
|
Réglages