doc/rdoc/core/classes/UnboundMethod.html in facets-2.4.3 vs doc/rdoc/core/classes/UnboundMethod.html in facets-2.4.4

- old
+ new

@@ -57,12 +57,10 @@ <tr valign="top"> <td>In:</td> <td> <a href="../files/lib/core/facets/unboundmethod/name_rb.html">lib/core/facets/unboundmethod/name.rb</a> <a href="../files/lib/core/facets/unboundmethod/arguments_rb.html">lib/core/facets/unboundmethod/arguments.rb</a> -<a href="../files/lib/core/facets/unboundmethod/name_rb.html">lib/core/facets/unboundmethod/name.rb</a> -<a href="../files/lib/core/facets/unboundmethod/arguments_rb.html">lib/core/facets/unboundmethod/arguments.rb</a> </td> </tr> <tr> <td>Parent:</td> <td> @@ -83,29 +81,27 @@ <div class="sectiontitle">Methods</div> <ul> - <li><a href="#M000450">arguments</a></li> - <li><a href="#M000448">arguments</a></li> - <li><a href="#M000449">name</a></li> - <li><a href="#M000447">name</a></li> + <li><a href="#M000304">arguments</a></li> + <li><a href="#M000303">name</a></li> </ul> <div class="sectiontitle">Public Instance methods</div> <div class="method"> <div class="title"> - <a name="M000450"></a><b>arguments</b>() + <a name="M000304"></a><b>arguments</b>() </div> <div class="description"> <p> -Resolves the <a href="UnboundMethod.html#M000448">arguments</a> of the +Resolves the <a href="UnboundMethod.html#M000304">arguments</a> of the method to have an identical signiture &#8212;useful for preserving arity. </p> <pre> class X def foo(a, b); end @@ -118,20 +114,20 @@ bar_method = X.instance_method(:bar) bar_method.arguments #=&gt; &quot;a0, *args&quot; </pre> <p> When defaults are used the <a -href="UnboundMethod.html#M000448">arguments</a> must end in +href="UnboundMethod.html#M000304">arguments</a> must end in &quot;*args&quot;. </p> <pre> CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000450_source')" id="l_M000450_source">show source</a> ]</p> - <div id="M000450_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000304_source')" id="l_M000304_source">show source</a> ]</p> + <div id="M000304_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/unboundmethod/arguments.rb, line 21</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">arguments</span> <span class="ruby-identifier">ar</span> = <span class="ruby-identifier">arity</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ar</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-value">0</span> @@ -158,76 +154,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000448"></a><b>arguments</b>() + <a name="M000303"></a><b>name</b>() </div> <div class="description"> <p> -Resolves the <a href="UnboundMethod.html#M000448">arguments</a> of the -method to have an identical signiture &#8212;useful for preserving arity. -</p> -<pre> - class X - def foo(a, b); end - def bar(a, b=1); end - end - - foo_method = X.instance_method(:foo) - foo_method.arguments #=&gt; &quot;a0, a1&quot; - - bar_method = X.instance_method(:bar) - bar_method.arguments #=&gt; &quot;a0, *args&quot; -</pre> -<p> -When defaults are used the <a -href="UnboundMethod.html#M000448">arguments</a> must end in -&quot;*args&quot;. -</p> -<pre> - CREDIT: Trans -</pre> - </div> -<div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000448_source')" id="l_M000448_source">show source</a> ]</p> - <div id="M000448_source" class="dyn-source"> -<pre> -<span class="ruby-comment cmt"># File lib/core/facets/unboundmethod/arguments.rb, line 21</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">arguments</span> - <span class="ruby-identifier">ar</span> = <span class="ruby-identifier">arity</span> - <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ar</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-value">0</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> - <span class="ruby-identifier">args</span> = [] - <span class="ruby-identifier">ar</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;a#{i}&quot;</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">args</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;, &quot;</span>) - <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> - <span class="ruby-identifier">args</span> = <span class="ruby-value str">&quot;&quot;</span> - <span class="ruby-keyword kw">else</span> - <span class="ruby-identifier">ar</span> = <span class="ruby-operator">-</span><span class="ruby-identifier">ar</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span> - <span class="ruby-identifier">args</span> = [] - <span class="ruby-identifier">ar</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;a#{i}&quot;</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;*args&quot;</span> - <span class="ruby-identifier">args</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;, &quot;</span>) - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">args</span> - <span class="ruby-keyword kw">end</span> -</pre> - </div> -</div> -</div> -<div class="method"> - <div class="title"> - <a name="M000449"></a><b>name</b>() - </div> - <div class="description"> - <p> -Return the <a href="UnboundMethod.html#M000447">name</a> of the method. Is +Return the <a href="UnboundMethod.html#M000303">name</a> of the method. Is this already in 1.9+ ? </p> <pre> class X def foo; end @@ -239,45 +174,11 @@ CREDIT: Trans </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000449_source')" id="l_M000449_source">show source</a> ]</p> - <div id="M000449_source" class="dyn-source"> -<pre> -<span class="ruby-comment cmt"># File lib/core/facets/unboundmethod/name.rb, line 18</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span> - <span class="ruby-identifier">i</span> = <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value str">'#'</span>) - <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>) - <span class="ruby-keyword kw">end</span> -</pre> - </div> -</div> -</div> -<div class="method"> - <div class="title"> - <a name="M000447"></a><b>name</b>() - </div> - <div class="description"> - <p> -Return the <a href="UnboundMethod.html#M000447">name</a> of the method. Is -this already in 1.9+ ? -</p> -<pre> - class X - def foo; end - end - - meth = X.instance_method(:foo) - - meth.name #=&gt; &quot;foo&quot; - - CREDIT: Trans -</pre> - </div> -<div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000447_source')" id="l_M000447_source">show source</a> ]</p> - <div id="M000447_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000303_source')" id="l_M000303_source">show source</a> ]</p> + <div id="M000303_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/core/facets/unboundmethod/name.rb, line 18</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value str">'#'</span>) <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>) \ No newline at end of file