doc/Caricature/Expectations.html in casualjim-caricature-0.5.0 vs doc/Caricature/Expectations.html in casualjim-caricature-0.6.0

- old
+ new

@@ -57,15 +57,15 @@ <div id="method-list-section" class="section"> <h3 class="section-header">Methods</h3> <ul class="link-list"> - <li><a href="#M000016">::new</a></li> + <li><a href="#M000023">::new</a></li> - <li><a href="#M000018">#add_expectation</a></li> + <li><a href="#M000025">#add_expectation</a></li> - <li><a href="#M000020">#find</a></li> + <li><a href="#M000028">#find</a></li> </ul> </div> @@ -200,11 +200,11 @@ <div id="public-class-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> <div id="new-method" class="method-detail "> - <a name="M000016"></a> + <a name="M000023"></a> <div class="method-heading"> <span class="method-name">new</span><span class="method-args">()</span> @@ -241,11 +241,11 @@ <div id="public-instance-method-details" class="method-section section"> <h3 class="section-header">Public Instance Methods</h3> <div id="add-expectation-method" class="method-detail "> - <a name="M000018"></a> + <a name="M000025"></a> <div class="method-heading"> <span class="method-name">add_expectation</span><span class="method-args">(expectation, mode=:instance)</span> @@ -277,11 +277,11 @@ </div> <div id="find-method" class="method-detail "> - <a name="M000020"></a> + <a name="M000028"></a> <div class="method-heading"> <span class="method-name">find</span><span class="method-args">(method_name, mode=:instance, *args)</span> @@ -308,10 +308,10 @@ <pre> <span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 24</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) <span class="ruby-identifier">expectations</span> = <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:class</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@class_expectations</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@instance_expectations</span> <span class="ruby-identifier">candidates</span> = <span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">exp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_sym</span> } - <span class="ruby-identifier">is_single</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:any</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">any_args?</span>) + <span class="ruby-identifier">is_single</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:any</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">any_args?</span>) <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_single</span> <span class="ruby-identifier">second_pass</span> = <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">exp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">args</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">args</span> } <span class="ruby-identifier">second_pass</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword kw">end</span></pre>