doc/rdoc/core/classes/Hash.html in facets-2.4.4 vs doc/rdoc/core/classes/Hash.html in facets-2.4.5

- old
+ new

@@ -30,16 +30,16 @@ return false; if( elem.style.display == "block" ) { elem.style.display = "none" - link.innerHTML = "show source" + link.innerHTML = "+" } else { elem.style.display = "block" - link.innerHTML = "hide source" + link.innerHTML = "-" } } function openCode( url ) { @@ -60,15 +60,18 @@ <a href="../files/lib/core/facets/to_hash_rb.html">lib/core/facets/to_hash.rb</a> <a href="../files/lib/core/facets/hash/alias_rb.html">lib/core/facets/hash/alias.rb</a> <a href="../files/lib/core/facets/hash/update_rb.html">lib/core/facets/hash/update.rb</a> <a href="../files/lib/core/facets/hash/autonew_rb.html">lib/core/facets/hash/autonew.rb</a> <a href="../files/lib/core/facets/hash/recursively_rb.html">lib/core/facets/hash/recursively.rb</a> +<a href="../files/lib/core/facets/hash/op_and_rb.html">lib/core/facets/hash/op_and.rb</a> +<a href="../files/lib/core/facets/hash/op_sub_rb.html">lib/core/facets/hash/op_sub.rb</a> <a href="../files/lib/core/facets/hash/except_rb.html">lib/core/facets/hash/except.rb</a> <a href="../files/lib/core/facets/hash/keys_rb.html">lib/core/facets/hash/keys.rb</a> <a href="../files/lib/core/facets/hash/merge_rb.html">lib/core/facets/hash/merge.rb</a> <a href="../files/lib/core/facets/hash/traverse_rb.html">lib/core/facets/hash/traverse.rb</a> -<a href="../files/lib/core/facets/hash/op_rb.html">lib/core/facets/hash/op.rb</a> +<a href="../files/lib/core/facets/hash/op_or_rb.html">lib/core/facets/hash/op_or.rb</a> +<a href="../files/lib/core/facets/hash/op_mul_rb.html">lib/core/facets/hash/op_mul.rb</a> <a href="../files/lib/core/facets/hash/op_push_rb.html">lib/core/facets/hash/op_push.rb</a> <a href="../files/lib/core/facets/hash/inverse_rb.html">lib/core/facets/hash/inverse.rb</a> <a href="../files/lib/core/facets/hash/recursive_merge_rb.html">lib/core/facets/hash/recursive_merge.rb</a> <a href="../files/lib/core/facets/hash/to_proc_rb.html">lib/core/facets/hash/to_proc.rb</a> <a href="../files/lib/core/facets/hash/insert_rb.html">lib/core/facets/hash/insert.rb</a> @@ -80,10 +83,11 @@ <a href="../files/lib/core/facets/hash/weave_rb.html">lib/core/facets/hash/weave.rb</a> <a href="../files/lib/core/facets/hash/swap_rb.html">lib/core/facets/hash/swap.rb</a> <a href="../files/lib/core/facets/hash/to_struct_rb.html">lib/core/facets/hash/to_struct.rb</a> <a href="../files/lib/core/facets/hash/join_rb.html">lib/core/facets/hash/join.rb</a> <a href="../files/lib/core/facets/hash/slice_rb.html">lib/core/facets/hash/slice.rb</a> +<a href="../files/lib/core/facets/hash/op_add_rb.html">lib/core/facets/hash/op_add.rb</a> <a href="../files/lib/core/facets/hash/rekey_rb.html">lib/core/facets/hash/rekey.rb</a> <a href="../files/lib/core/facets/hash/argumentize_rb.html">lib/core/facets/hash/argumentize.rb</a> <a href="../files/lib/core/facets/hash/at_rb.html">lib/core/facets/hash/at.rb</a> <a href="../files/lib/core/facets/blank_rb.html">lib/core/facets/blank.rb</a> </td> @@ -107,74 +111,72 @@ <div class="sectiontitle">Methods</div> - <ul> - <li><a href="#M000096">&amp;</a></li> - <li><a href="#M000100">*</a></li> - <li><a href="#M000098">+</a></li> - <li><a href="#M000099">-</a></li> - <li><a href="#M000101">&lt;&lt;</a></li> - <li><a href="#M000075">alias!</a></li> - <li><a href="#M000125">argumentize</a></li> - <li><a href="#M000080">autonew</a></li> - <li><a href="#M000112">collate</a></li> - <li><a href="#M000113">collate!</a></li> - <li><a href="#M000114">delete_unless</a></li> - <li><a href="#M000115">delete_values</a></li> - <li><a href="#M000116">delete_values_at</a></li> - <li><a href="#M000109">diff</a></li> - <li><a href="#M000090">each_with_key</a></li> - <li><a href="#M000084">except</a></li> - <li><a href="#M000085">except!</a></li> - <li><a href="#M000111">graph!</a></li> - <li><a href="#M000086">has_keys?</a></li> - <li><a href="#M000088">has_only_keys?</a></li> - <li><a href="#M000107">insert</a></li> - <li><a href="#M000102">inverse</a></li> - <li><a href="#M000120">join</a></li> - <li><a href="#M000087">keys?</a></li> - <li><a href="#M000110">mash!</a></li> - <li><a href="#M000089">only_keys?</a></li> - <li><a href="#M000103">recursive_merge</a></li> - <li><a href="#M000104">recursive_merge!</a></li> - <li><a href="#M000082">recursively</a></li> - <li><a href="#M000083">recursively!</a></li> - <li><a href="#M000123">rekey</a></li> - <li><a href="#M000124">rekey!</a></li> - <li><a href="#M000079">replace_each</a></li> - <li><a href="#M000091">reverse_merge</a></li> - <li><a href="#M000092">reverse_merge!</a></li> - <li><a href="#M000093">reverse_update</a></li> - <li><a href="#M000108">select!</a></li> - <li><a href="#M000121">slice</a></li> - <li><a href="#M000122">slice!</a></li> - <li><a href="#M000118">swap!</a></li> - <li><a href="#M000074">to_h</a></li> - <li><a href="#M000105">to_proc</a></li> - <li><a href="#M000106">to_proc_with_reponse</a></li> - <li><a href="#M000119">to_struct</a></li> - <li><a href="#M000094">traverse</a></li> - <li><a href="#M000095">traverse!</a></li> - <li><a href="#M000076">update_each</a></li> - <li><a href="#M000077">update_keys</a></li> - <li><a href="#M000078">update_values</a></li> - <li><a href="#M000117">weave</a></li> - <li><a href="#M000081">zipnew</a></li> - <li><a href="#M000097">|</a></li> - </ul> + <span style="padding-right: 5px;"><a href="#M000085">&amp;</a></span> + <span style="padding-right: 5px;"><a href="#M000100">*</a></span> + <span style="padding-right: 5px;"><a href="#M000123">+</a></span> + <span style="padding-right: 5px;"><a href="#M000086">-</a></span> + <span style="padding-right: 5px;"><a href="#M000101">&lt;&lt;</a></span> + <span style="padding-right: 5px;"><a href="#M000076">alias!</a></span> + <span style="padding-right: 5px;"><a href="#M000126">argumentize</a></span> + <span style="padding-right: 5px;"><a href="#M000081">autonew</a></span> + <span style="padding-right: 5px;"><a href="#M000112">collate</a></span> + <span style="padding-right: 5px;"><a href="#M000113">collate!</a></span> + <span style="padding-right: 5px;"><a href="#M000114">delete_unless</a></span> + <span style="padding-right: 5px;"><a href="#M000115">delete_values</a></span> + <span style="padding-right: 5px;"><a href="#M000116">delete_values_at</a></span> + <span style="padding-right: 5px;"><a href="#M000109">diff</a></span> + <span style="padding-right: 5px;"><a href="#M000093">each_with_key</a></span> + <span style="padding-right: 5px;"><a href="#M000087">except</a></span> + <span style="padding-right: 5px;"><a href="#M000088">except!</a></span> + <span style="padding-right: 5px;"><a href="#M000111">graph!</a></span> + <span style="padding-right: 5px;"><a href="#M000089">has_keys?</a></span> + <span style="padding-right: 5px;"><a href="#M000091">has_only_keys?</a></span> + <span style="padding-right: 5px;"><a href="#M000107">insert</a></span> + <span style="padding-right: 5px;"><a href="#M000102">inverse</a></span> + <span style="padding-right: 5px;"><a href="#M000120">join</a></span> + <span style="padding-right: 5px;"><a href="#M000090">keys?</a></span> + <span style="padding-right: 5px;"><a href="#M000110">mash!</a></span> + <span style="padding-right: 5px;"><a href="#M000092">only_keys?</a></span> + <span style="padding-right: 5px;"><a href="#M000103">recursive_merge</a></span> + <span style="padding-right: 5px;"><a href="#M000104">recursive_merge!</a></span> + <span style="padding-right: 5px;"><a href="#M000083">recursively</a></span> + <span style="padding-right: 5px;"><a href="#M000084">recursively!</a></span> + <span style="padding-right: 5px;"><a href="#M000124">rekey</a></span> + <span style="padding-right: 5px;"><a href="#M000125">rekey!</a></span> + <span style="padding-right: 5px;"><a href="#M000080">replace_each</a></span> + <span style="padding-right: 5px;"><a href="#M000094">reverse_merge</a></span> + <span style="padding-right: 5px;"><a href="#M000095">reverse_merge!</a></span> + <span style="padding-right: 5px;"><a href="#M000096">reverse_update</a></span> + <span style="padding-right: 5px;"><a href="#M000108">select!</a></span> + <span style="padding-right: 5px;"><a href="#M000121">slice</a></span> + <span style="padding-right: 5px;"><a href="#M000122">slice!</a></span> + <span style="padding-right: 5px;"><a href="#M000118">swap!</a></span> + <span style="padding-right: 5px;"><a href="#M000075">to_h</a></span> + <span style="padding-right: 5px;"><a href="#M000105">to_proc</a></span> + <span style="padding-right: 5px;"><a href="#M000106">to_proc_with_reponse</a></span> + <span style="padding-right: 5px;"><a href="#M000119">to_struct</a></span> + <span style="padding-right: 5px;"><a href="#M000097">traverse</a></span> + <span style="padding-right: 5px;"><a href="#M000098">traverse!</a></span> + <span style="padding-right: 5px;"><a href="#M000077">update_each</a></span> + <span style="padding-right: 5px;"><a href="#M000078">update_keys</a></span> + <span style="padding-right: 5px;"><a href="#M000079">update_values</a></span> + <span style="padding-right: 5px;"><a href="#M000117">weave</a></span> + <span style="padding-right: 5px;"><a href="#M000082">zipnew</a></span> + <span style="padding-right: 5px;"><a href="#M000099">|</a></span> <div class="sectiontitle">Public Class methods</div> <div class="method"> <div class="title"> - <a name="M000080"></a><b>autonew</b>(*args) + <a name="M000081"></a><b>autonew</b>(*args) </div> <div class="description"> <p> <a href="Hash.html">Hash</a> which auto initializes it&#8216;s children. </p> @@ -194,12 +196,12 @@ <p> CREDIT: Trans CREDIT: Jan Molic </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show source</a> ]</p> - <div id="M000080_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">+</a> ]</p> + <div id="M000081_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/autonew.rb, line 20</span> <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">autonew</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) <span class="ruby-comment cmt">#new(*args){|a,k| a[k] = self.class::new(*args)}</span> <span class="ruby-identifier">leet</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">new</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">leet</span> ) } @@ -209,11 +211,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000081"></a><b>zipnew</b>(keys,values) + <a name="M000082"></a><b>zipnew</b>(keys,values) </div> <div class="description"> <p> Creates a new hash from two arrays &#8212;a keys array and a values array. </p> @@ -224,12 +226,12 @@ CREDIT: Trans CREDIT: Ara T. Howard </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show source</a> ]</p> - <div id="M000081_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">+</a> ]</p> + <div id="M000082_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/autonew.rb, line 35</span> <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">zipnew</span>(<span class="ruby-identifier">keys</span>,<span class="ruby-identifier">values</span>) <span class="ruby-comment cmt"># or some better name</span> <span class="ruby-identifier">h</span> = {} <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">times</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[ <span class="ruby-identifier">keys</span>[<span class="ruby-identifier">i</span>] ] = <span class="ruby-identifier">values</span>[<span class="ruby-identifier">i</span>] } @@ -240,11 +242,11 @@ </div> </div> <div class="sectiontitle">Public Instance methods</div> <div class="method"> <div class="title"> - <a name="M000096"></a><b>&amp;</b>(other) + <a name="M000085"></a><b>&amp;</b>(other) </div> <div class="description"> <p> <a href="Hash.html">Hash</a> intersection. Two hashes intersect when their pairs are equal. @@ -265,14 +267,14 @@ <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000096_source')" id="l_M000096_source">show source</a> ]</p> - <div id="M000096_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">+</a> ]</p> + <div id="M000085_source" class="dyn-source"> <pre> -<span class="ruby-comment cmt"># File lib/core/facets/hash/op.rb, line 19</span> +<span class="ruby-comment cmt"># File lib/core/facets/hash/op_and.rb, line 19</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&amp;</span>(<span class="ruby-identifier">other</span>) <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">other</span> <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span> <span class="ruby-identifier">k</span> = (<span class="ruby-identifier">keys</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">other</span>) <span class="ruby-constant">Hash</span>[<span class="ruby-operator">*</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">k</span>)).<span class="ruby-identifier">flatten</span>)] @@ -304,48 +306,48 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000100_source')" id="l_M000100_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000100_source')" id="l_M000100_source">+</a> ]</p> <div id="M000100_source" class="dyn-source"> <pre> -<span class="ruby-comment cmt"># File lib/core/facets/hash/op.rb, line 80</span> +<span class="ruby-comment cmt"># File lib/core/facets/hash/op_mul.rb, line 13</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">*</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">other</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000098"></a><b>+</b>(other) + <a name="M000123"></a><b>+</b>(other) </div> <div class="description"> <p> Operator for merge. </p> <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000098_source')" id="l_M000098_source">show source</a> ]</p> - <div id="M000098_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000123_source')" id="l_M000123_source">+</a> ]</p> + <div id="M000123_source" class="dyn-source"> <pre> -<span class="ruby-comment cmt"># File lib/core/facets/hash/op.rb, line 44</span> +<span class="ruby-comment cmt"># File lib/core/facets/hash/op_add.rb, line 7</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">other</span>) <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000099"></a><b>-</b>(other) + <a name="M000086"></a><b>-</b>(other) </div> <div class="description"> <p> Operator for remove hash paris. If another hash is given the pairs are only removed if both key and value are equal. If an array is given then matching @@ -354,14 +356,14 @@ <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000099_source')" id="l_M000099_source">show source</a> ]</p> - <div id="M000099_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">+</a> ]</p> + <div id="M000086_source" class="dyn-source"> <pre> -<span class="ruby-comment cmt"># File lib/core/facets/hash/op.rb, line 54</span> +<span class="ruby-comment cmt"># File lib/core/facets/hash/op_sub.rb, line 9</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">h</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_ary</span>) <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_ary</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) @@ -390,11 +392,11 @@ <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000101_source')" id="l_M000101_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000101_source')" id="l_M000101_source">+</a> ]</p> <div id="M000101_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/op_push.rb, line 8</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">other</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_ary</span>) @@ -408,11 +410,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000075"></a><b>alias!</b>(newkey, oldkey) + <a name="M000076"></a><b>alias!</b>(newkey, oldkey) </div> <div class="description"> <p> Modifies the receiving <a href="Hash.html">Hash</a> so that the value previously referred to by <em>oldkey</em> is also referenced by @@ -443,12 +445,12 @@ <p> TODO: Rename to aliaskey or something else. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p> - <div id="M000075_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">+</a> ]</p> + <div id="M000076_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/alias.rb, line 25</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alias!</span>(<span class="ruby-identifier">newkey</span>, <span class="ruby-identifier">oldkey</span>) <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">newkey</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">oldkey</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">oldkey</span>) <span class="ruby-keyword kw">self</span> @@ -457,11 +459,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000125"></a><b>argumentize</b>(args_field=nil) + <a name="M000126"></a><b>argumentize</b>(args_field=nil) </div> <div class="description"> <p> Turn a hash into arguments. </p> @@ -471,12 +473,12 @@ h.argumentize(:list) #=&gt; [ [1,2], { :base =&gt; &quot;HI&quot; } ] h.argumentize(:base) #=&gt; [ [&quot;HI&quot;], { :list =&gt; [1,2] } ] </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000125_source')" id="l_M000125_source">show source</a> ]</p> - <div id="M000125_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000126_source')" id="l_M000126_source">+</a> ]</p> + <div id="M000126_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/argumentize.rb, line 10</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">argumentize</span>(<span class="ruby-identifier">args_field</span>=<span class="ruby-keyword kw">nil</span>) <span class="ruby-identifier">config</span> = <span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args_field</span> @@ -506,11 +508,11 @@ CREDIT: Gavin Kistner (Phrogz) </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">+</a> ]</p> <div id="M000112_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/collate.rb, line 11</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collate</span>(<span class="ruby-identifier">other_hash</span>) <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">collate!</span>(<span class="ruby-identifier">other_hash</span>) @@ -528,11 +530,11 @@ The same as <a href="Hash.html#M000112">collate</a>, but modifies the receiver in place. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000113_source')" id="l_M000113_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000113_source')" id="l_M000113_source">+</a> ]</p> <div id="M000113_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/collate.rb, line 17</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collate!</span>(<span class="ruby-identifier">other_hash</span>) <span class="ruby-comment cmt"># Prepare, ensuring every existing key is already an Array</span> @@ -575,11 +577,11 @@ <pre> CREDIT: Daniel Schierbeck </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000114_source')" id="l_M000114_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000114_source')" id="l_M000114_source">+</a> ]</p> <div id="M000114_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/delete.rb, line 11</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_unless</span> <span class="ruby-comment cmt">#:yield:</span> <span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>) } @@ -604,11 +606,11 @@ CREDIT: Daniel Schierbeck </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">+</a> ]</p> <div id="M000115_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/delete.rb, line 24</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_values</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">values</span>) <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>)) } @@ -639,11 +641,11 @@ CREDIT: Daniel Schierbeck </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000116_source')" id="l_M000116_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000116_source')" id="l_M000116_source">+</a> ]</p> <div id="M000116_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/delete.rb, line 42</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keys</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">yld</span>) <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">yld</span>) } @@ -660,11 +662,11 @@ <p> Difference comparison of two hashes. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000109_source')" id="l_M000109_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000109_source')" id="l_M000109_source">+</a> ]</p> <div id="M000109_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/diff.rb, line 5</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">diff</span>(<span class="ruby-identifier">hash</span>) <span class="ruby-identifier">h1</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">v</span> } @@ -675,11 +677,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000090"></a><b>each_with_key</b>( &amp;yld ) + <a name="M000093"></a><b>each_with_key</b>( &amp;yld ) </div> <div class="description"> <p> Each with key is like each_pair but reverses the order the parameters to [value,key] instead of [key,value]. @@ -687,12 +689,12 @@ <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000090_source')" id="l_M000090_source">show source</a> ]</p> - <div id="M000090_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000093_source')" id="l_M000093_source">+</a> ]</p> + <div id="M000093_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/keys.rb, line 40</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_with_key</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">yld</span> ) <span class="ruby-identifier">each_pair</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">yld</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">v</span>,<span class="ruby-identifier">k</span>) } <span class="ruby-keyword kw">end</span> @@ -700,20 +702,20 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000084"></a><b>except</b>(*less_keys) + <a name="M000087"></a><b>except</b>(*less_keys) </div> <div class="description"> <p> Returns a new hash less the given keys. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show source</a> ]</p> - <div id="M000084_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">+</a> ]</p> + <div id="M000087_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/except.rb, line 5</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">except</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">less_keys</span>) <span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">less_keys</span>) <span class="ruby-keyword kw">end</span> @@ -721,11 +723,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000085"></a><b>except!</b>(*less_keys) + <a name="M000088"></a><b>except!</b>(*less_keys) </div> <div class="description"> <p> Replaces hash with new hash less the given keys. This returns the hash of keys removed. @@ -735,12 +737,12 @@ h.except!(:a) #=&gt; {:a=&gt;1} h #=&gt; {:b=&gt;2,:c=&gt;3} </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show source</a> ]</p> - <div id="M000085_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">+</a> ]</p> + <div id="M000088_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/except.rb, line 18</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">except!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">less_keys</span>) <span class="ruby-identifier">removed</span> = <span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">less_keys</span>) <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">except</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">less_keys</span>)) @@ -760,11 +762,11 @@ </p> </div> </div> <div class="method"> <div class="title"> - <a name="M000086"></a><b>has_keys?</b>(*check_keys) + <a name="M000089"></a><b>has_keys?</b>(*check_keys) </div> <div class="description"> <p> Returns true or false whether the hash contains the given keys. </p> @@ -776,15 +778,15 @@ CREDIT: Trans </pre> </div> <div class="aka"> This method is also aliased as - <a href="Hash.html#M000087">keys?</a> + <a href="Hash.html#M000090">keys?</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show source</a> ]</p> - <div id="M000086_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">+</a> ]</p> + <div id="M000089_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/keys.rb, line 12</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_keys?</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">check_keys</span>) <span class="ruby-identifier">unknown_keys</span> = <span class="ruby-identifier">check_keys</span> <span class="ruby-operator">-</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">keys</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">unknown_keys</span>.<span class="ruby-identifier">empty?</span> @@ -793,11 +795,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000088"></a><b>has_only_keys?</b>(*check_keys) + <a name="M000091"></a><b>has_only_keys?</b>(*check_keys) </div> <div class="description"> <p> Returns true if the hash contains <em>only</em> the given keys, otherwise false. @@ -810,15 +812,15 @@ CREDIT: Trans </pre> </div> <div class="aka"> This method is also aliased as - <a href="Hash.html#M000089">only_keys?</a> + <a href="Hash.html#M000092">only_keys?</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">show source</a> ]</p> - <div id="M000088_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000091_source')" id="l_M000091_source">+</a> ]</p> + <div id="M000091_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/keys.rb, line 28</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_only_keys?</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">check_keys</span>) <span class="ruby-identifier">unknown_keys</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">check_keys</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">unknown_keys</span>.<span class="ruby-identifier">empty?</span> @@ -841,11 +843,11 @@ <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000107_source')" id="l_M000107_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000107_source')" id="l_M000107_source">+</a> ]</p> <div id="M000107_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/insert.rb, line 10</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">name</span>) @@ -878,11 +880,11 @@ CREDIT: Tilo Sloboda </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000102_source')" id="l_M000102_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000102_source')" id="l_M000102_source">+</a> ]</p> <div id="M000102_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/inverse.rb, line 14</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inverse</span> <span class="ruby-identifier">i</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> @@ -910,11 +912,11 @@ <pre> CREDIT: Mauricio Fernandez </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000120_source')" id="l_M000120_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000120_source')" id="l_M000120_source">+</a> ]</p> <div id="M000120_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/join.rb, line 7</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-identifier">pair_divider</span>=<span class="ruby-value str">''</span>, <span class="ruby-identifier">elem_divider</span>=<span class="ruby-value str">''</span>) <span class="ruby-identifier">s</span> = [] @@ -925,11 +927,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000087"></a><b>keys?</b>(*check_keys) + <a name="M000090"></a><b>keys?</b>(*check_keys) </div> <div class="description"> <p> Alias for has_keys? </p> @@ -951,11 +953,11 @@ <div class="aka"> This method is also aliased as <a href="Hash.html#M000111">graph!</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000110_source')" id="l_M000110_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000110_source')" id="l_M000110_source">+</a> ]</p> <div id="M000110_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/mash.rb, line 10</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mash!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">yld</span>) <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">mash</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">yld</span>)) @@ -964,11 +966,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000089"></a><b>only_keys?</b>(*check_keys) + <a name="M000092"></a><b>only_keys?</b>(*check_keys) </div> <div class="description"> <p> Alias for has_only_keys? </p> @@ -978,16 +980,16 @@ <div class="title"> <a name="M000103"></a><b>recursive_merge</b>(other) </div> <div class="description"> <p> -Same as Hash#merge but <a href="Hash.html#M000082">recursively</a> merges +Same as Hash#merge but <a href="Hash.html#M000083">recursively</a> merges sub-hashes. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000103_source')" id="l_M000103_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000103_source')" id="l_M000103_source">+</a> ]</p> <div id="M000103_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/recursive_merge.rb, line 5</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursive_merge</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">hash</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> @@ -1009,16 +1011,16 @@ <div class="title"> <a name="M000104"></a><b>recursive_merge!</b>(other) </div> <div class="description"> <p> -Same as Hash#merge! but <a href="Hash.html#M000082">recursively</a> merges +Same as Hash#merge! but <a href="Hash.html#M000083">recursively</a> merges sub-hashes. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000104_source')" id="l_M000104_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000104_source')" id="l_M000104_source">+</a> ]</p> <div id="M000104_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/recursive_merge.rb, line 20</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursive_merge!</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">other</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> @@ -1035,26 +1037,26 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000082"></a><b>recursively</b>() {|h| ...} + <a name="M000083"></a><b>recursively</b>() {|h| ...} </div> <div class="description"> <p> -Apply a block to hash, and <a href="Hash.html#M000082">recursively</a> +Apply a block to hash, and <a href="Hash.html#M000083">recursively</a> apply that block to each subhash. </p> <pre> h = {:a=&gt;1, :b=&gt;{:b1=&gt;1, :b2=&gt;2}} h.recursively{|h| h.rekey(&amp;:to_s) } =&gt; {&quot;a&quot;=&gt;1, &quot;b&quot;=&gt;{&quot;b1&quot;=&gt;1, &quot;b2&quot;=&gt;2}} </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show source</a> ]</p> - <div id="M000082_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">+</a> ]</p> + <div id="M000083_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/recursively.rb, line 10</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursively</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">h</span> = <span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, (<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)<span class="ruby-operator">|</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) @@ -1070,15 +1072,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000083"></a><b>recursively!</b>(&amp;block) + <a name="M000084"></a><b>recursively!</b>(&amp;block) </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show source</a> ]</p> - <div id="M000083_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">+</a> ]</p> + <div id="M000084_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/recursively.rb, line 24</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recursively!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">recursively</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)) <span class="ruby-keyword kw">end</span> @@ -1086,16 +1088,16 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000123"></a><b>rekey</b>(*args, &amp;block) + <a name="M000124"></a><b>rekey</b>(*args, &amp;block) </div> <div class="description"> <p> -<a href="Hash.html#M000123">rekey</a>(to_key, from_key) <a -href="Hash.html#M000123">rekey</a>{ |key| &#8230; } +<a href="Hash.html#M000124">rekey</a>(to_key, from_key) <a +href="Hash.html#M000124">rekey</a>{ |key| &#8230; } </p> <p> If two keys are given, then the second key is changed to the first. </p> <pre> @@ -1117,12 +1119,12 @@ CREDIT: Trans CREDIT: Gavin Kistner </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000123_source')" id="l_M000123_source">show source</a> ]</p> - <div id="M000123_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000124_source')" id="l_M000124_source">+</a> ]</p> + <div id="M000124_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/rekey.rb, line 27</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rekey</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">rekey!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">end</span> @@ -1130,15 +1132,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000124"></a><b>rekey!</b>(*args, &amp;block) + <a name="M000125"></a><b>rekey!</b>(*args, &amp;block) </div> <div class="description"> <p> -Synonym for <a href="Hash.html#M000123">Hash#rekey</a>, but modifies the +Synonym for <a href="Hash.html#M000124">Hash#rekey</a>, but modifies the receiver in place (and returns it). </p> <pre> foo = { :name=&gt;'Gavin', :wife=&gt;:Lisa } foo.rekey!{ |k| k.to_s } #=&gt; { &quot;name&quot;=&gt;&quot;Gavin&quot;, &quot;wife&quot;=&gt;:Lisa } @@ -1147,12 +1149,12 @@ CREDIT: Trans CREDIT: Gavin Kistner </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000124_source')" id="l_M000124_source">show source</a> ]</p> - <div id="M000124_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000125_source')" id="l_M000125_source">+</a> ]</p> + <div id="M000125_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/rekey.rb, line 40</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rekey!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># for backward comptability (TODO: DEPRECATE).</span> <span class="ruby-identifier">block</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">to_sym</span>.<span class="ruby-identifier">to_proc</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> @@ -1174,24 +1176,24 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000079"></a><b>replace_each</b>( {|| ...} + <a name="M000080"></a><b>replace_each</b>( {|| ...} </div> <div class="description"> <p> -Same as <a href="Hash.html#M000076">update_each</a>, but deletes the key +Same as <a href="Hash.html#M000077">update_each</a>, but deletes the key element first. </p> <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show source</a> ]</p> - <div id="M000079_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">+</a> ]</p> + <div id="M000080_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/update.rb, line 55</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace_each</span> <span class="ruby-comment cmt"># :yield:</span> <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) @@ -1203,11 +1205,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000091"></a><b>reverse_merge</b>(other) + <a name="M000094"></a><b>reverse_merge</b>(other) </div> <div class="description"> <p> Allows for reverse merging where its the keys in the calling hash that wins over those in the <tt>other_hash</tt>. This is particularly useful for @@ -1222,12 +1224,12 @@ The default :size and :velocity is only set if the <tt>options</tt> passed in doesn&#8216;t already have those keys set. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000091_source')" id="l_M000091_source">show source</a> ]</p> - <div id="M000091_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000094_source')" id="l_M000094_source">+</a> ]</p> + <div id="M000094_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/merge.rb, line 15</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse_merge</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">other</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">end</span> @@ -1235,24 +1237,24 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000092"></a><b>reverse_merge!</b>(other) + <a name="M000095"></a><b>reverse_merge!</b>(other) </div> <div class="description"> <p> -Inplace form of <a href="Hash.html#M000091">reverse_merge</a>. +Inplace form of <a href="Hash.html#M000094">reverse_merge</a>. </p> </div> <div class="aka"> This method is also aliased as - <a href="Hash.html#M000093">reverse_update</a> + <a href="Hash.html#M000096">reverse_update</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000092_source')" id="l_M000092_source">show source</a> ]</p> - <div id="M000092_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000095_source')" id="l_M000095_source">+</a> ]</p> + <div id="M000095_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/merge.rb, line 21</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">reverse_merge</span>(<span class="ruby-identifier">other</span>)) <span class="ruby-keyword kw">end</span> @@ -1260,15 +1262,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000093"></a><b>reverse_update</b>(other) + <a name="M000096"></a><b>reverse_update</b>(other) </div> <div class="description"> <p> -Alias for <a href="Hash.html#M000091">reverse_merge</a>! +Alias for <a href="Hash.html#M000094">reverse_merge</a>! </p> </div> </div> <div class="method"> <div class="title"> @@ -1282,11 +1284,11 @@ CREDIT Gavin Sinclair CREDIT Noah Gibbs </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000108_source')" id="l_M000108_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000108_source')" id="l_M000108_source">+</a> ]</p> <div id="M000108_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/select.rb, line 9</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select!</span> <span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>) } @@ -1303,11 +1305,11 @@ <p> Returns a new hash with only the given keys. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">+</a> ]</p> <div id="M000121_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/slice.rb, line 9</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keep_keys</span>) <span class="ruby-identifier">h</span> = {} @@ -1334,11 +1336,11 @@ h.slice!(:a) #=&gt; {:a=&gt;1} h #=&gt; {:b=&gt;2} </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">+</a> ]</p> <div id="M000122_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/slice.rb, line 24</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slice!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keep_keys</span>) <span class="ruby-identifier">removed</span> = <span class="ruby-identifier">except</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">keep_keys</span>) @@ -1363,11 +1365,11 @@ <p> CREDIT: Gavin Sinclair </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000118_source')" id="l_M000118_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000118_source')" id="l_M000118_source">+</a> ]</p> <div id="M000118_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/swap.rb, line 9</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">swap!</span>(<span class="ruby-identifier">key1</span>, <span class="ruby-identifier">key2</span>) <span class="ruby-identifier">tmp</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key1</span>] @@ -1379,11 +1381,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000074"></a><b>to_h</b>() + <a name="M000075"></a><b>to_h</b>() </div> <div class="description"> <p> Return a rehashing of <em>self</em>. </p> @@ -1393,12 +1395,12 @@ <p> CREDIT: Forian Gross </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show source</a> ]</p> - <div id="M000074_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">+</a> ]</p> + <div id="M000075_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 54</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>; <span class="ruby-identifier">rehash</span>; <span class="ruby-keyword kw">end</span> </pre> </div> @@ -1424,11 +1426,11 @@ <p> CREDIT: Trans </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000105_source')" id="l_M000105_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000105_source')" id="l_M000105_source">+</a> ]</p> <div id="M000105_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/to_proc.rb, line 15</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc</span> <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> @@ -1457,11 +1459,11 @@ <p> CREDIT: Trans </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000106_source')" id="l_M000106_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000106_source')" id="l_M000106_source">+</a> ]</p> <div id="M000106_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/to_proc.rb, line 31</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc_with_reponse</span> <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> @@ -1493,11 +1495,11 @@ <pre> CREDIT: Daniel Berger </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000119_source')" id="l_M000119_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000119_source')" id="l_M000119_source">+</a> ]</p> <div id="M000119_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/to_struct.rb, line 12</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_struct</span>(<span class="ruby-identifier">struct_name</span>) <span class="ruby-constant">Struct</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">struct_name</span>,<span class="ruby-operator">*</span><span class="ruby-identifier">keys</span>).<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">values</span>) @@ -1506,11 +1508,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000094"></a><b>traverse</b>(&amp;b) + <a name="M000097"></a><b>traverse</b>(&amp;b) </div> <div class="description"> <p> Returns a new hash created by traversing the hash and its subhashes, executing the given block on the key and value. The block should return a @@ -1533,12 +1535,12 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000094_source')" id="l_M000094_source">show source</a> ]</p> - <div id="M000094_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000097_source')" id="l_M000097_source">+</a> ]</p> + <div id="M000097_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/traverse.rb, line 18</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">traverse</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>) <span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)<span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> = ( <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">v</span> <span class="ruby-value">? </span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">traverse</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">v</span> ) @@ -1551,15 +1553,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000095"></a><b>traverse!</b>(&amp;b) + <a name="M000098"></a><b>traverse!</b>(&amp;b) </div> <div class="description"> <p> -In place version of <a href="Hash.html#M000094">traverse</a>, which +In place version of <a href="Hash.html#M000097">traverse</a>, which traverses the hash and its subhashes, executing the given block on the key and value. </p> <pre> h = { &quot;A&quot;=&gt;&quot;A&quot;, &quot;B&quot;=&gt;&quot;B&quot; } @@ -1568,12 +1570,12 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000095_source')" id="l_M000095_source">show source</a> ]</p> - <div id="M000095_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000098_source')" id="l_M000098_source">+</a> ]</p> + <div id="M000098_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/traverse.rb, line 36</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">traverse!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">traverse</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>) ) <span class="ruby-keyword kw">end</span> @@ -1581,26 +1583,26 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000076"></a><b>update_each</b>( {|| ...} + <a name="M000077"></a><b>update_each</b>( {|| ...} </div> <div class="description"> <p> Iterates through each pair and updates a the hash in place. This is formally equivalent to mash! But does not use mash to accomplish the task. -Hence <a href="Hash.html#M000076">update_each</a> is probably a touch +Hence <a href="Hash.html#M000077">update_each</a> is probably a touch faster. </p> <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show source</a> ]</p> - <div id="M000076_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">+</a> ]</p> + <div id="M000077_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/update.rb, line 12</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_each</span> <span class="ruby-comment cmt"># :yield:</span> <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">update</span>(<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)) @@ -1611,11 +1613,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000077"></a><b>update_keys</b>( {|| ...} + <a name="M000078"></a><b>update_keys</b>( {|| ...} </div> <div class="description"> <p> Iterate over hash updating just the keys. </p> @@ -1626,12 +1628,12 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show source</a> ]</p> - <div id="M000077_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">+</a> ]</p> + <div id="M000078_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/update.rb, line 27</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_keys</span> <span class="ruby-comment cmt">#:yield:</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">old_key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">store</span>(<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">old_key</span>), <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">old_key</span>)) } @@ -1643,11 +1645,11 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000078"></a><b>update_values</b>( {|| ...} + <a name="M000079"></a><b>update_values</b>( {|| ...} </div> <div class="description"> <p> Iterate over hash updating just the values. </p> @@ -1658,12 +1660,12 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show source</a> ]</p> - <div id="M000078_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">+</a> ]</p> + <div id="M000079_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/update.rb, line 43</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_values</span> <span class="ruby-comment cmt">#:yield:</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span> <span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">store</span>(<span class="ruby-identifier">k</span>, <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">v</span>)) } @@ -1722,11 +1724,11 @@ <pre> CREDIT: Thomas Sawyer </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000117_source')" id="l_M000117_source">show source</a> ]</p> + <p class="source-link">[ <a href="javascript:toggleSource('M000117_source')" id="l_M000117_source">+</a> ]</p> <div id="M000117_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/hash/weave.rb, line 40</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weave</span>(<span class="ruby-identifier">h</span>) <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Hash expected&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>) @@ -1772,24 +1774,24 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000097"></a><b>|</b>(other) + <a name="M000099"></a><b>|</b>(other) </div> <div class="description"> <p> -Operator for <a href="Hash.html#M000091">reverse_merge</a>. +Operator for <a href="Hash.html#M000094">reverse_merge</a>. </p> <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000097_source')" id="l_M000097_source">show source</a> ]</p> - <div id="M000097_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000099_source')" id="l_M000099_source">+</a> ]</p> + <div id="M000099_source" class="dyn-source"> <pre> -<span class="ruby-comment cmt"># File lib/core/facets/hash/op.rb, line 36</span> +<span class="ruby-comment cmt"># File lib/core/facets/hash/op_or.rb, line 7</span> <span class="ruby-keyword kw">def</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">other</span>) <span class="ruby-identifier">other</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">end</span> </pre> </div> \ No newline at end of file