VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /opt/alt/ruby18/share/ri/1.8/system/Hash/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/ruby18/share/ri/1.8/system/Hash/fetch-i.yaml
--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Returns a value from the hash for the given key. If the key can't be found, there are several options: With no other arguments, it will raise an <tt>IndexError</tt> exception; if <em>default</em> is given, then that will be returned; if the optional code block is specified, then that will be run and its result returned."
- !ruby/struct:SM::Flow::VERB 
  body: "   h = { &quot;a&quot; =&gt; 100, &quot;b&quot; =&gt; 200 }\n   h.fetch(&quot;a&quot;)                            #=&gt; 100\n   h.fetch(&quot;z&quot;, &quot;go fish&quot;)                 #=&gt; &quot;go fish&quot;\n   h.fetch(&quot;z&quot;) { |el| &quot;go fish, #{el}&quot;}   #=&gt; &quot;go fish, z&quot;\n"
- !ruby/struct:SM::Flow::P 
  body: The following example shows that an exception is raised if the key is not found and a default value is not supplied.
- !ruby/struct:SM::Flow::VERB 
  body: "   h = { &quot;a&quot; =&gt; 100, &quot;b&quot; =&gt; 200 }\n   h.fetch(&quot;z&quot;)\n"
- !ruby/struct:SM::Flow::P 
  body: <em>produces:</em>
- !ruby/struct:SM::Flow::VERB 
  body: "   prog.rb:2:in `fetch': key not found (IndexError)\n    from prog.rb:2\n"
full_name: Hash#fetch
is_singleton: false
name: fetch
params: |
  hsh.fetch(key [, default] )       => obj
  hsh.fetch(key) {| key | block }   => obj

visibility: public

VaKeR 2022