PHP 8.2.31
Preview: new-c.yaml Size: 1.66 KB
/proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Hash/new-c.yaml

--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Returns a new, empty hash. If this hash is subsequently accessed by a key that doesn't correspond to a hash entry, the value returned depends on the style of <tt>new</tt> used to create the hash. In the first form, the access returns <tt>nil</tt>. If <em>obj</em> is specified, this single object will be used for all <em>default values</em>. If a block is specified, it will be called with the hash object and the key, and should return the default value. It is the block's responsibility to store the value in the hash if required.
- !ruby/struct:SM::Flow::VERB 
  body: "   h = Hash.new(&quot;Go Fish&quot;)\n   h[&quot;a&quot;] = 100\n   h[&quot;b&quot;] = 200\n   h[&quot;a&quot;]           #=&gt; 100\n   h[&quot;c&quot;]           #=&gt; &quot;Go Fish&quot;\n   # The following alters the single default object\n   h[&quot;c&quot;].upcase!   #=&gt; &quot;GO FISH&quot;\n   h[&quot;d&quot;]           #=&gt; &quot;GO FISH&quot;\n   h.keys           #=&gt; [&quot;a&quot;, &quot;b&quot;]\n\n   # While this creates a new default object each time\n   h = Hash.new { |hash, key| hash[key] = &quot;Go Fish: #{key}&quot; }\n   h[&quot;c&quot;]           #=&gt; &quot;Go Fish: c&quot;\n   h[&quot;c&quot;].upcase!   #=&gt; &quot;GO FISH: C&quot;\n   h[&quot;d&quot;]           #=&gt; &quot;Go Fish: d&quot;\n   h.keys           #=&gt; [&quot;c&quot;, &quot;d&quot;]\n"
full_name: Hash::new
is_singleton: true
name: new
params: |
  Hash.new                          => hash
  Hash.new(obj)                     => aHash
  Hash.new {|hash, key| block }     => aHash

visibility: public

Directory Contents

Dirs: 0 × Files: 55

Name Size Perms Modified Actions
833 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
744 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
818 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
567 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
4.20 KB lrw-r--r-- 2023-07-26 13:47:11
Edit Download
470 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
878 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
998 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
633 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
884 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
571 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
882 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
576 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
649 B lrw-r--r-- 2023-07-26 13:47:11
Edit Download
596 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
370 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
330 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
1.38 KB lrw-r--r-- 2023-07-26 13:47:12
Edit Download
359 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
623 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
554 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
623 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
471 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
319 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
319 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
558 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
273 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
602 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
615 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
544 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
557 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
621 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
1.27 KB lrw-r--r-- 2023-07-26 13:47:12
Edit Download
852 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
1.66 KB lrw-r--r-- 2023-07-26 13:47:11
Edit Download
177 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
189 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
886 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
344 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
387 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
542 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
660 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
627 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
553 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
747 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
746 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
550 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
248 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
635 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
177 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
1.27 KB lrw-r--r-- 2023-07-26 13:47:12
Edit Download
546 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
485 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
620 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download
192 B lrw-r--r-- 2023-07-26 13:47:12
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).