doc/Bauxite/Context.html in bauxite-0.6.18 vs doc/Bauxite/Context.html in bauxite-0.6.19

- old
+ new

@@ -4,25 +4,22 @@ <head> <meta charset="UTF-8"> <title>class Bauxite::Context - RDoc Documentation</title> -<link href="../fonts.css" rel="stylesheet"> -<link href="../rdoc.css" rel="stylesheet"> - <script type="text/javascript"> var rdoc_rel_prefix = "../"; </script> <script src="../js/jquery.js"></script> -<script src="../js/navigation.js"></script> -<script src="../js/search_index.js"></script> -<script src="../js/search.js"></script> -<script src="../js/searcher.js"></script> <script src="../js/darkfish.js"></script> +<link href="../css/fonts.css" rel="stylesheet"> +<link href="../css/rdoc.css" rel="stylesheet"> + + <body id="top" role="document" class="class"> <nav role="navigation"> <div id="project-navigation"> <div id="home-section" role="region" title="Quick navigation" class="nav-section"> <h2> @@ -171,11 +168,11 @@ <p>The Main test context. This class includes state and helper functions used by clients execute tests and by actions and selectors to interact with the test engine (i.e. Selenium WebDriver).</p> -<h3 id="class-Bauxite::Context-label-Context+variables"><a href="Context.html">Context</a> variables<span><a href="#class-Bauxite::Context-label-Context+variables">&para;</a> <a href="#documentation">&uarr;</a></span></h3> +<h3 id="class-Bauxite::Context-label-Context+variables"><a href="Context.html">Context</a> variables<span><a href="#class-Bauxite::Context-label-Context+variables">&para;</a> <a href="#top">&uarr;</a></span></h3> <p><a href="Context.html">Context</a> variables are a key/value pairs scoped to the a test context.</p> <p>Variables can be set using different actions. For example:</p> @@ -191,27 +188,28 @@ </li><li> <p><a href="Action.html#method-i-js">Bauxite::Action#js</a> sets a variable to the result of Javascript command.</p> </li><li> <p><a href="Action.html#method-i-replace">Bauxite::Action#replace</a> sets a -variable to the result of doing a find-and-replace operation on a literal.</p> +variable to the result of doing a find-and-replace operation on a literal.</p> </li></ul> <p>Variables can be expanded in every <a href="Action.html">Action</a> argument (e.g. selectors, texts, expressions, etc.). To obtain the value of a variable through variable expansion the following syntax must be used:</p> <pre>${var_name}</pre> <p>For example:</p> -<pre>set field &quot;greeting&quot; -set name &quot;John&quot; -write &quot;${field}_textbox&quot; &quot;Hi, my name is ${name}!&quot; -click &quot;${field}_button&quot;</pre> +<pre class="ruby"><span class="ruby-identifier">set</span> <span class="ruby-identifier">field</span> <span class="ruby-string">&quot;greeting&quot;</span> +<span class="ruby-identifier">set</span> <span class="ruby-identifier">name</span> <span class="ruby-string">&quot;John&quot;</span> +<span class="ruby-identifier">write</span> <span class="ruby-string">&quot;${field}_textbox&quot;</span> <span class="ruby-string">&quot;Hi, my name is ${name}!&quot;</span> +<span class="ruby-identifier">click</span> <span class="ruby-string">&quot;${field}_button&quot;</span> +</pre> -<h3 id="class-Bauxite::Context-label-Variable+scope">Variable scope<span><a href="#class-Bauxite::Context-label-Variable+scope">&para;</a> <a href="#documentation">&uarr;</a></span></h3> +<h3 id="class-Bauxite::Context-label-Variable+scope">Variable scope<span><a href="#class-Bauxite::Context-label-Variable+scope">&para;</a> <a href="#top">&uarr;</a></span></h3> <p>When the main test starts (via the <a href="Context.html#method-i-start">start</a> method), the test is bound to the global scope. The variables defined in the global scope are available to every test <a href="Action.html">Action</a>.</p> @@ -237,11 +235,11 @@ <ul><li> <p><a href="Action.html#method-i-return_action">Bauxite::Action#return_action</a></p> </li></ul> -<h3 id="class-Bauxite::Context-label-Built-in+variable">Built-in variable<span><a href="#class-Bauxite::Context-label-Built-in+variable">&para;</a> <a href="#documentation">&uarr;</a></span></h3> +<h3 id="class-Bauxite::Context-label-Built-in+variable">Built-in variable<span><a href="#class-Bauxite::Context-label-Built-in+variable">&para;</a> <a href="#top">&uarr;</a></span></h3> <p><a href="../Bauxite.html">Bauxite</a> has a series of built-in variables that provide information of the current test context and allow dynamic constomizations of the test behavior.</p> @@ -402,33 +400,33 @@ <div class="method-source-code" id="new-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 138</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>) - <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span> - <span class="ruby-ivar">@driver_name</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-value">:driver</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:firefox</span>).<span class="ruby-identifier">to_sym</span> - <span class="ruby-ivar">@variables</span> = { - <span class="ruby-string">&#39;__TIMEOUT__&#39;</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>, - <span class="ruby-string">&#39;__DEBUG__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>, - <span class="ruby-string">&#39;__SELECTOR__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;sid&#39;</span>, - <span class="ruby-string">&#39;__OUTPUT__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:output</span>], - <span class="ruby-string">&#39;__DIR__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>) - } - <span class="ruby-ivar">@aliases</span> = {} - <span class="ruby-ivar">@tests</span> = [] - - <span class="ruby-identifier">client</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Remote</span><span class="ruby-operator">::</span><span class="ruby-constant">Http</span><span class="ruby-operator">::</span><span class="ruby-constant">Default</span>.<span class="ruby-identifier">new</span> - <span class="ruby-identifier">client</span>.<span class="ruby-identifier">timeout</span> = (<span class="ruby-ivar">@options</span>[<span class="ruby-value">:open_timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">60</span>).<span class="ruby-identifier">to_i</span> - <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] = {} <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] - <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>][<span class="ruby-value">:http_client</span>] = <span class="ruby-identifier">client</span> - - <span class="ruby-identifier">_load_extensions</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:extensions</span>] <span class="ruby-operator">||</span> []) - - <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:logger</span>], <span class="ruby-identifier">options</span>[<span class="ruby-value">:logger_opt</span>]) - - <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>) +<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>) + <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span> + <span class="ruby-ivar">@driver_name</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-value">:driver</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:firefox</span>).<span class="ruby-identifier">to_sym</span> + <span class="ruby-ivar">@variables</span> = { + <span class="ruby-string">&#39;__TIMEOUT__&#39;</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>, + <span class="ruby-string">&#39;__DEBUG__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>, + <span class="ruby-string">&#39;__SELECTOR__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;sid&#39;</span>, + <span class="ruby-string">&#39;__OUTPUT__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:output</span>], + <span class="ruby-string">&#39;__DIR__&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>) + } + <span class="ruby-ivar">@aliases</span> = {} + <span class="ruby-ivar">@tests</span> = [] + + <span class="ruby-identifier">client</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Remote</span><span class="ruby-operator">::</span><span class="ruby-constant">Http</span><span class="ruby-operator">::</span><span class="ruby-constant">Default</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">client</span>.<span class="ruby-identifier">timeout</span> = (<span class="ruby-ivar">@options</span>[<span class="ruby-value">:open_timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">60</span>).<span class="ruby-identifier">to_i</span> + <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] = {} <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] + <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>][<span class="ruby-value">:http_client</span>] = <span class="ruby-identifier">client</span> + + <span class="ruby-identifier">_load_extensions</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:extensions</span>] <span class="ruby-operator">||</span> []) + + <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:logger</span>], <span class="ruby-identifier">options</span>[<span class="ruby-value">:logger_opt</span>]) + + <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -470,12 +468,12 @@ <div class="method-source-code" id="debug-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 269</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span> - <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">&#39;debug&#39;</span>, [], <span class="ruby-keyword">false</span>) +<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span> + <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">&#39;debug&#39;</span>, [], <span class="ruby-keyword">false</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -503,13 +501,13 @@ <div class="method-source-code" id="driver-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 259</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">driver</span> - <span class="ruby-identifier">_load_driver</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@driver</span> - <span class="ruby-ivar">@driver</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">driver</span> + <span class="ruby-identifier">_load_driver</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@driver</span> + <span class="ruby-ivar">@driver</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -535,11 +533,11 @@ <p>Finds an element by <code>selector</code>.</p> <p>The element found is yielded to the given <code>block</code> (if any) and returned.</p> -<p>Note that the recommeneded way to call this method is by passing a +<p>Note that the recommeneded way to call this method is by passing a <code>block</code>. This is because the method ensures that the element context is maintained for the duration of the <code>block</code> but it makes no guarantees after the <code>block</code> completes (the same applies if no <code>block</code> was given).</p> @@ -561,14 +559,14 @@ <div class="method-source-code" id="find-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 252</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># yields: element</span> - <span class="ruby-identifier">with_timeout</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchElementError</span> <span class="ruby-keyword">do</span> - <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__SELECTOR__&#39;</span>]).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># yields: element </span> + <span class="ruby-identifier">with_timeout</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchElementError</span> <span class="ruby-keyword">do</span> + <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__SELECTOR__&#39;</span>]).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -611,16 +609,16 @@ <div class="method-source-code" id="get_value-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 288</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>) - <span class="ruby-keyword">if</span> [<span class="ruby-string">&#39;input&#39;</span>,<span class="ruby-string">&#39;select&#39;</span>,<span class="ruby-string">&#39;textarea&#39;</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">tag_name</span>.<span class="ruby-identifier">downcase</span> - <span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">&#39;value&#39;</span>) - <span class="ruby-keyword">else</span> - <span class="ruby-identifier">element</span>.<span class="ruby-identifier">text</span> - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>) + <span class="ruby-keyword">if</span> [<span class="ruby-string">&#39;input&#39;</span>,<span class="ruby-string">&#39;select&#39;</span>,<span class="ruby-string">&#39;textarea&#39;</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">tag_name</span>.<span class="ruby-identifier">downcase</span> + <span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">&#39;value&#39;</span>) + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">element</span>.<span class="ruby-identifier">text</span> + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -645,22 +643,21 @@ <p>Stops the test engine and starts a new engine with the same provider.</p> <p>For example:</p> -<pre class="ruby"><span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">reset_driver</span> -=<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">closes</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">browser</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">opens</span> <span class="ruby-identifier">a</span> <span class="ruby-identifier">new</span> <span class="ruby-identifier">one</span> -</pre> +<pre>ctx.reset_driver +=&gt; closes the browser and opens a new one</pre> <div class="method-source-code" id="reset_driver-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 200</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span> - <span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span> - <span class="ruby-ivar">@driver</span> = <span class="ruby-keyword">nil</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span> + <span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span> + <span class="ruby-ivar">@driver</span> = <span class="ruby-keyword">nil</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -703,25 +700,25 @@ <div class="method-source-code" id="start-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 177</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = []) - <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> - <span class="ruby-keyword">begin</span> - <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span> - <span class="ruby-keyword">begin</span> - <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span> - <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>) - <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:debug</span>] - <span class="ruby-identifier">debug</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">ensure</span> - <span class="ruby-identifier">stop</span> - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = []) + <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> + <span class="ruby-keyword">begin</span> + <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span> + <span class="ruby-keyword">begin</span> + <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span> + <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>) + <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:debug</span>] + <span class="ruby-identifier">debug</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">ensure</span> + <span class="ruby-identifier">stop</span> + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -767,20 +764,20 @@ <div class="method-source-code" id="stop-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 220</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span> - <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">wait</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:wait</span>] - <span class="ruby-keyword">begin</span> - <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-keyword">self</span>) - <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>) - <span class="ruby-identifier">raise</span> - <span class="ruby-keyword">ensure</span> - <span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span> - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span> + <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">wait</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:wait</span>] + <span class="ruby-keyword">begin</span> + <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-keyword">self</span>) + <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>) + <span class="ruby-identifier">raise</span> + <span class="ruby-keyword">ensure</span> + <span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span> + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -840,27 +837,27 @@ <div class="method-source-code" id="load_logger-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 432</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">loggers</span>, <span class="ruby-identifier">options</span>) - <span class="ruby-keyword">if</span> <span class="ruby-identifier">loggers</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span> - <span class="ruby-keyword">return</span> <span class="ruby-constant">Loggers</span><span class="ruby-operator">::</span><span class="ruby-constant">CompositeLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">loggers</span>) - <span class="ruby-keyword">end</span> - - <span class="ruby-identifier">name</span> = <span class="ruby-identifier">loggers</span> - - <span class="ruby-identifier">log_name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;null&#39;</span>).<span class="ruby-identifier">downcase</span> - - <span class="ruby-identifier">class_name</span> = <span class="ruby-node">&quot;#{log_name.capitalize}Logger&quot;</span> - - <span class="ruby-keyword">unless</span> <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_defined?</span> <span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">to_sym</span> - <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, - <span class="ruby-node">&quot;Invalid logger &#39;#{log_name}&#39;&quot;</span> - <span class="ruby-keyword">end</span> - - <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">class_name</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>) +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">loggers</span>, <span class="ruby-identifier">options</span>) + <span class="ruby-keyword">if</span> <span class="ruby-identifier">loggers</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span> + <span class="ruby-keyword">return</span> <span class="ruby-constant">Loggers</span><span class="ruby-operator">::</span><span class="ruby-constant">CompositeLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">loggers</span>) + <span class="ruby-keyword">end</span> + + <span class="ruby-identifier">name</span> = <span class="ruby-identifier">loggers</span> + + <span class="ruby-identifier">log_name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">&#39;null&#39;</span>).<span class="ruby-identifier">downcase</span> + + <span class="ruby-identifier">class_name</span> = <span class="ruby-node">&quot;#{log_name.capitalize}Logger&quot;</span> + + <span class="ruby-keyword">unless</span> <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_defined?</span> <span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">to_sym</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, + <span class="ruby-node">&quot;Invalid logger &#39;#{log_name}&#39;&quot;</span> + <span class="ruby-keyword">end</span> + + <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">class_name</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -888,41 +885,41 @@ <div class="method-source-code" id="parse_action_default-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 460</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">&#39;&lt;unknown&gt;&#39;</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>) - <span class="ruby-identifier">data</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39; &#39;</span>, <span class="ruby-value">2</span>) - <span class="ruby-keyword">begin</span> - <span class="ruby-identifier">args_text</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span> <span class="ruby-operator">:</span> <span class="ruby-string">&#39;&#39;</span> - <span class="ruby-identifier">args</span> = [] - - <span class="ruby-keyword">unless</span> <span class="ruby-identifier">args_text</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;&#39;</span> - <span class="ruby-comment"># col_sep must be a regex because String.split has a</span> - <span class="ruby-comment"># special case for a single space char (&#39; &#39;) that produced</span> - <span class="ruby-comment"># unexpected results (i.e. if line is &#39;&quot;a b&quot;&#39; the</span> - <span class="ruby-comment"># resulting array contains [&quot;a b&quot;]).</span> - <span class="ruby-comment">#</span> - <span class="ruby-comment"># ...but... </span> - <span class="ruby-comment">#</span> - <span class="ruby-comment"># CSV expects col_sep to be a string so we need to work</span> - <span class="ruby-comment"># some dark magic here. Basically we proxy the StringIO</span> - <span class="ruby-comment"># received by CSV to returns strings for which the split</span> - <span class="ruby-comment"># method does not fold the whitespaces.</span> - <span class="ruby-comment">#</span> - <span class="ruby-identifier">args</span> = <span class="ruby-constant">CSV</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIOProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args_text</span>), { <span class="ruby-value">:col_sep</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39; &#39;</span> }) - .<span class="ruby-identifier">shift</span> - .<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> } <span class="ruby-operator">||</span> [] - <span class="ruby-keyword">end</span> - - { - <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>, - <span class="ruby-value">:args</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span> - } - <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{file} (line #{line+1}): #{e.message}&quot;</span> - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">&#39;&lt;unknown&gt;&#39;</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>) + <span class="ruby-identifier">data</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39; &#39;</span>, <span class="ruby-value">2</span>) + <span class="ruby-keyword">begin</span> + <span class="ruby-identifier">args_text</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span> <span class="ruby-operator">:</span> <span class="ruby-string">&#39;&#39;</span> + <span class="ruby-identifier">args</span> = [] + + <span class="ruby-keyword">unless</span> <span class="ruby-identifier">args_text</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;&#39;</span> + <span class="ruby-comment"># col_sep must be a regex because String.split has a </span> + <span class="ruby-comment"># special case for a single space char (&#39; &#39;) that produced </span> + <span class="ruby-comment"># unexpected results (i.e. if line is &#39;&quot;a b&quot;&#39; the </span> + <span class="ruby-comment"># resulting array contains [&quot;a b&quot;]). </span> + <span class="ruby-comment"># </span> + <span class="ruby-comment"># ...but... </span> + <span class="ruby-comment"># </span> + <span class="ruby-comment"># CSV expects col_sep to be a string so we need to work </span> + <span class="ruby-comment"># some dark magic here. Basically we proxy the StringIO </span> + <span class="ruby-comment"># received by CSV to returns strings for which the split </span> + <span class="ruby-comment"># method does not fold the whitespaces. </span> + <span class="ruby-comment"># </span> + <span class="ruby-identifier">args</span> = <span class="ruby-constant">CSV</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIOProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args_text</span>), { <span class="ruby-value">:col_sep</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39; &#39;</span> }) + .<span class="ruby-identifier">shift</span> + .<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> } <span class="ruby-operator">||</span> [] + <span class="ruby-keyword">end</span> + + { + <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>, + <span class="ruby-value">:args</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span> + } + <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{file} (line #{line+1}): #{e.message}&quot;</span> + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -956,12 +953,12 @@ <div class="method-source-code" id="wait-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 425</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span> - <span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">&quot;Press ENTER to continue\n&quot;</span>) +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span> + <span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">&quot;Press ENTER to continue\n&quot;</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -998,12 +995,12 @@ <div class="method-source-code" id="add_alias-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 454</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_alias</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>) - <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">name</span>] = { <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">action</span>, <span class="ruby-value">:args</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span> } +<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_alias</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>) + <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">name</span>] = { <span class="ruby-value">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">action</span>, <span class="ruby-value">:args</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span> } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1041,13 +1038,13 @@ <div class="method-source-code" id="exec_action-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 309</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>) - <span class="ruby-identifier">data</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-string">&#39;&lt;unknown&gt;&#39;</span>, <span class="ruby-value">0</span>) - <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">data</span>[<span class="ruby-value">:action</span>], <span class="ruby-identifier">data</span>[<span class="ruby-value">:args</span>], <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) +<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>) + <span class="ruby-identifier">data</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-string">&#39;&lt;unknown&gt;&#39;</span>, <span class="ruby-value">0</span>) + <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">data</span>[<span class="ruby-value">:action</span>], <span class="ruby-identifier">data</span>[<span class="ruby-value">:args</span>], <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1080,21 +1077,22 @@ href="Context.html#method-i-exec_action">exec_action</a> method is preferred.</p> <p>For example:</p> -<pre>action = ctx.get_action(&quot;echo&quot;, [&#39;Hi!&#39;], &#39;echo &quot;Hi!&quot;&#39;) -ret = ctx.exec_action_object(action) -ret.call if ret.respond_to? :call</pre> +<pre class="ruby"><span class="ruby-identifier">action</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">get_action</span>(<span class="ruby-string">&quot;echo&quot;</span>, [<span class="ruby-string">&#39;Hi!&#39;</span>], <span class="ruby-string">&#39;echo &quot;Hi!&quot;&#39;</span>) +<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) +<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> :<span class="ruby-identifier">call</span> +</pre> <div class="method-source-code" id="exec_action_object-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 540</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) - <span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) + <span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1128,25 +1126,25 @@ <div class="method-source-code" id="exec_file-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 320</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>) - <span class="ruby-identifier">current_dir</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span> ] - <span class="ruby-identifier">current_file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] - <span class="ruby-identifier">current_line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] - - <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span> - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>)) - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] = <span class="ruby-identifier">file</span> - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] = <span class="ruby-identifier">line</span> - <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span> - <span class="ruby-keyword">end</span> - - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span> ] = <span class="ruby-identifier">current_dir</span> - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] = <span class="ruby-identifier">current_file</span> - <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] = <span class="ruby-identifier">current_line</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>) + <span class="ruby-identifier">current_dir</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span> ] + <span class="ruby-identifier">current_file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] + <span class="ruby-identifier">current_line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] + + <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span> + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>)) + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] = <span class="ruby-identifier">file</span> + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] = <span class="ruby-identifier">line</span> + <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span> + <span class="ruby-keyword">end</span> + + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__DIR__&#39;</span> ] = <span class="ruby-identifier">current_dir</span> + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] = <span class="ruby-identifier">current_file</span> + <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] = <span class="ruby-identifier">current_line</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1189,29 +1187,29 @@ <div class="method-source-code" id="exec_parsed_action-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 350</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>) - <span class="ruby-identifier">action</span> = <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>) - <span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span> - <span class="ruby-keyword">if</span> <span class="ruby-identifier">log</span> - <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log_cmd</span>(<span class="ruby-identifier">action</span>) <span class="ruby-keyword">do</span> - <span class="ruby-constant">Readline</span><span class="ruby-operator">::</span><span class="ruby-constant">HISTORY</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">text</span> - <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">else</span> - <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) - <span class="ruby-keyword">end</span> - - <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:call</span> <span class="ruby-comment"># delayed actions (after log_cmd)</span> - <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span> - <span class="ruby-keyword">else</span> - <span class="ruby-identifier">ret</span> - <span class="ruby-keyword">end</span> -<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">UnhandledAlertError</span> - <span class="ruby-identifier">raise</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionError</span>, <span class="ruby-string">&quot;Unexpected modal present&quot;</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>) + <span class="ruby-identifier">action</span> = <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>) + <span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span> + <span class="ruby-keyword">if</span> <span class="ruby-identifier">log</span> + <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log_cmd</span>(<span class="ruby-identifier">action</span>) <span class="ruby-keyword">do</span> + <span class="ruby-constant">Readline</span><span class="ruby-operator">::</span><span class="ruby-constant">HISTORY</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">text</span> + <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>) + <span class="ruby-keyword">end</span> + + <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:call</span> <span class="ruby-comment"># delayed actions (after log_cmd) </span> + <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span> + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">ret</span> + <span class="ruby-keyword">end</span> +<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">UnhandledAlertError</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionError</span>, <span class="ruby-string">&quot;Unexpected modal present&quot;</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1246,35 +1244,35 @@ <div class="method-source-code" id="get_action-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 500</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>) - <span class="ruby-keyword">while</span> (<span class="ruby-identifier">alias_action</span> = <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">action</span>]) - <span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>] - <span class="ruby-identifier">args</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$\{(\d+)(\*q?)?\}/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> - <span class="ruby-comment"># expand ${1} to args[0], ${2} to args[1], etc.</span> - <span class="ruby-comment"># expand ${4*} to &quot;#{args[4]} #{args[5]} ...&quot;</span> - <span class="ruby-comment"># expand ${4*q} to &quot;\&quot;#{args[4]}\&quot; \&quot;#{args[5]}\&quot; ...&quot;</span> - <span class="ruby-identifier">idx</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> - <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> - <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span> - <span class="ruby-keyword">else</span> - <span class="ruby-identifier">range</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] - <span class="ruby-identifier">range</span> = <span class="ruby-identifier">range</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-string">&#39;&quot;&#39;</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&quot;&quot;&#39;</span>)<span class="ruby-operator">+</span><span class="ruby-string">&#39;&quot;&#39;</span> } <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;*q&#39;</span> - <span class="ruby-identifier">range</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>) - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> - - <span class="ruby-identifier">text</span> = ([<span class="ruby-identifier">action</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">&#39;&quot;&#39;</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&quot;&quot;&#39;</span>)<span class="ruby-operator">+</span><span class="ruby-string">&#39;&quot;&#39;</span> }).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span> - <span class="ruby-identifier">file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] - <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] - - <span class="ruby-constant">Action</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>) +<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>) + <span class="ruby-keyword">while</span> (<span class="ruby-identifier">alias_action</span> = <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">action</span>]) + <span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>] + <span class="ruby-identifier">args</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$\{(\d+)(\*q?)?\}/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> + <span class="ruby-comment"># expand ${1} to args[0], ${2} to args[1], etc. </span> + <span class="ruby-comment"># expand ${4*} to &quot;#{args[4]} #{args[5]} ...&quot; </span> + <span class="ruby-comment"># expand ${4*q} to &quot;\&quot;#{args[4]}\&quot; \&quot;#{args[5]}\&quot; ...&quot; </span> + <span class="ruby-identifier">idx</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> + <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> + <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&#39;&#39;</span> + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">range</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] + <span class="ruby-identifier">range</span> = <span class="ruby-identifier">range</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-string">&#39;&quot;&#39;</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&quot;&quot;&#39;</span>)<span class="ruby-operator">+</span><span class="ruby-string">&#39;&quot;&#39;</span> } <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;*q&#39;</span> + <span class="ruby-identifier">range</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>) + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> + + <span class="ruby-identifier">text</span> = ([<span class="ruby-identifier">action</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">&#39;&quot;&#39;</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&quot;&quot;&#39;</span>)<span class="ruby-operator">+</span><span class="ruby-string">&#39;&quot;&#39;</span> }).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span> + <span class="ruby-identifier">file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__FILE__&#39;</span>] + <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__LINE__&#39;</span>] + + <span class="ruby-constant">Action</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>) <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1295,11 +1293,11 @@ </div> <div class="method-description"> - <p>Returns the output path for <code>path</code> accounting for the + <p>Returns the output path for <code>path</code> accounting for the <code>__OUTPUT__</code> variable.</p> <p>For example:</p> <pre class="ruby"><span class="ruby-comment"># assuming --output /mnt/disk</span> @@ -1314,19 +1312,19 @@ <div class="method-source-code" id="output_path-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 585</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">path</span>) - <span class="ruby-keyword">unless</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">absolute?</span> - <span class="ruby-identifier">output</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__OUTPUT__&#39;</span>] - <span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span> - <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span> <span class="ruby-identifier">output</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">output</span> - <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">path</span>) - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> - <span class="ruby-identifier">path</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">path</span>) + <span class="ruby-keyword">unless</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">absolute?</span> + <span class="ruby-identifier">output</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__OUTPUT__&#39;</span>] + <span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span> + <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span> <span class="ruby-identifier">output</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">output</span> + <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">path</span>) + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> + <span class="ruby-identifier">path</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1347,11 +1345,11 @@ </div> <div class="method-description"> - <p>Prints the specified <code>error</code> using the Logger configured and + <p>Prints the specified <code>error</code> using the Logger configured and handling the verbose option.</p> <p>For example:</p> <pre class="ruby"><span class="ruby-keyword">begin</span> @@ -1365,26 +1363,26 @@ <div class="method-source-code" id="print_error-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 555</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">capture</span> = <span class="ruby-keyword">true</span>) - <span class="ruby-keyword">if</span> <span class="ruby-ivar">@logger</span> - <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log</span> <span class="ruby-node">&quot;#{e.message}\n&quot;</span>, <span class="ruby-value">:error</span> - <span class="ruby-keyword">else</span> - <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:verbose</span>] - <span class="ruby-identifier">p</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span> - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">if</span> <span class="ruby-identifier">capture</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:capture</span>] - <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>) <span class="ruby-keyword">do</span> - <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">&#39;capture&#39;</span>, [] , <span class="ruby-keyword">false</span>) - <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">&#39;__CAPTURE__&#39;</span>] = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__CAPTURE__&#39;</span>] - <span class="ruby-keyword">end</span> - <span class="ruby-keyword">end</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">capture</span> = <span class="ruby-keyword">true</span>) + <span class="ruby-keyword">if</span> <span class="ruby-ivar">@logger</span> + <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log</span> <span class="ruby-node">&quot;#{e.message}\n&quot;</span>, <span class="ruby-value">:error</span> + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:verbose</span>] + <span class="ruby-identifier">p</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span> + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">if</span> <span class="ruby-identifier">capture</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:capture</span>] + <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>) <span class="ruby-keyword">do</span> + <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">&#39;capture&#39;</span>, [] , <span class="ruby-keyword">false</span>) + <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">&#39;__CAPTURE__&#39;</span>] = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__CAPTURE__&#39;</span>] + <span class="ruby-keyword">end</span> + <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1425,17 +1423,17 @@ <div class="method-source-code" id="with_driver_timeout-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 410</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>) - <span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span> - <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">timeout</span> - <span class="ruby-keyword">yield</span> -<span class="ruby-keyword">ensure</span> - <span class="ruby-ivar">@driver_timeout</span> = <span class="ruby-identifier">current</span> - <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">current</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>) + <span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span> + <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">timeout</span> + <span class="ruby-keyword">yield</span> +<span class="ruby-keyword">ensure</span> + <span class="ruby-ivar">@driver_timeout</span> = <span class="ruby-identifier">current</span> + <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">current</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1474,23 +1472,23 @@ <div class="method-source-code" id="with_timeout-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 382</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_timeout</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span>) - <span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span> - <span class="ruby-identifier">timeout</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">stime</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__TIMEOUT__&#39;</span>] - <span class="ruby-keyword">yield</span> -<span class="ruby-keyword">rescue</span> <span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span> - <span class="ruby-identifier">rem</span> = <span class="ruby-identifier">timeout</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t</span> - <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rem</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> - - <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">progress</span>(<span class="ruby-identifier">rem</span>.<span class="ruby-identifier">round</span>) - - <span class="ruby-identifier">sleep</span>(<span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">10.0</span>) <span class="ruby-keyword">if</span> (<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stime</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> - <span class="ruby-keyword">retry</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_timeout</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span>) + <span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">timeout</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">stime</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__TIMEOUT__&#39;</span>].<span class="ruby-identifier">to_i</span> + <span class="ruby-keyword">yield</span> +<span class="ruby-keyword">rescue</span> <span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">rem</span> = <span class="ruby-identifier">timeout</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t</span> + <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rem</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> + + <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">progress</span>(<span class="ruby-identifier">rem</span>.<span class="ruby-identifier">round</span>) + + <span class="ruby-identifier">sleep</span>(<span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">10.0</span>) <span class="ruby-keyword">if</span> (<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stime</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> + <span class="ruby-keyword">retry</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1555,13 +1553,13 @@ <div class="method-source-code" id="action_args-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 616</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">action_args</span>(<span class="ruby-identifier">action</span>) - <span class="ruby-identifier">action</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&#39;_action&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">action</span> - <span class="ruby-constant">Action</span>.<span class="ruby-identifier">public_instance_method</span>(<span class="ruby-identifier">action</span>).<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">att</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> } +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">action_args</span>(<span class="ruby-identifier">action</span>) + <span class="ruby-identifier">action</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&#39;_action&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">action</span> + <span class="ruby-constant">Action</span>.<span class="ruby-identifier">public_instance_method</span>(<span class="ruby-identifier">action</span>).<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">att</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1595,12 +1593,12 @@ <div class="method-source-code" id="actions-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 606</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span> - <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_action$/</span>, <span class="ruby-string">&#39;&#39;</span>) } +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span> + <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_action$/</span>, <span class="ruby-string">&#39;&#39;</span>) } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1634,12 +1632,12 @@ <div class="method-source-code" id="loggers-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 645</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span> - <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/logger$/</span>, <span class="ruby-string">&#39;&#39;</span>) } +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span> + <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/logger$/</span>, <span class="ruby-string">&#39;&#39;</span>) } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1676,12 +1674,12 @@ <div class="method-source-code" id="max_action_name_size-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 669</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span> - <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> } +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span> + <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1715,13 +1713,14 @@ <div class="method-source-code" id="parsers-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 655</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span> - (<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>) <span class="ruby-operator">-</span> <span class="ruby-constant">ParserModule</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>)) - .<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_s</span> } +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span> + (<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>) \ + <span class="ruby-operator">-</span> <span class="ruby-constant">ParserModule</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>)) + .<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_s</span> } <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1746,11 +1745,11 @@ <p>Returns an array with the names of every selector available.</p> <p>If <code>include_standard_selectors</code> is <code>true</code> (default behavior) both standard and custom selector are returned, otherwise only -custom selectors are returned.</p> +custom selectors are returned.</p> <p>For example:</p> <pre class="ruby"><span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">selectors</span> <span class="ruby-comment"># =&gt; [ &quot;class&quot;, &quot;id&quot;, ... ]</span> @@ -1759,16 +1758,16 @@ <div class="method-source-code" id="selectors-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 631</span> -<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">selectors</span>(<span class="ruby-identifier">include_standard_selectors</span> = <span class="ruby-keyword">true</span>) - <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_selector$/</span>, <span class="ruby-string">&#39;&#39;</span>) } - <span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span> - <span class="ruby-identifier">ret</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">SearchContext</span><span class="ruby-operator">::</span><span class="ruby-constant">FINDERS</span>.<span class="ruby-identifier">map</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">k</span>.<span class="ruby-identifier">to_s</span> } - <span class="ruby-keyword">end</span> - <span class="ruby-identifier">ret</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">selectors</span>(<span class="ruby-identifier">include_standard_selectors</span> = <span class="ruby-keyword">true</span>) + <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_selector$/</span>, <span class="ruby-string">&#39;&#39;</span>) } + <span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span> + <span class="ruby-identifier">ret</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">SearchContext</span><span class="ruby-operator">::</span><span class="ruby-constant">FINDERS</span>.<span class="ruby-identifier">map</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">k</span>.<span class="ruby-identifier">to_s</span> } + <span class="ruby-keyword">end</span> + <span class="ruby-identifier">ret</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1825,11 +1824,12 @@ <p>Recursively replaces occurencies of variable expansions in <code>s</code> with the corresponding variable value.</p> <p>The variable expansion expression format is:</p> -<pre>&#39;${variable_name}&#39;</pre> +<pre class="ruby"><span class="ruby-string">&#39;${variable_name}&#39;</span> +</pre> <p>For example:</p> <pre class="ruby"><span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">variables</span> = { <span class="ruby-string">&#39;a&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;1&#39;</span>, <span class="ruby-string">&#39;b&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;2&#39;</span>, <span class="ruby-string">&#39;c&#39;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;a&#39;</span> } <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">expand</span> <span class="ruby-string">&#39;${a}&#39;</span> <span class="ruby-comment"># =&gt; &#39;1&#39;</span> @@ -1841,16 +1841,16 @@ <div class="method-source-code" id="expand-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 690</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>) - <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">kv</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/\$\{#{kv[0]}\}/</span>, <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>) - <span class="ruby-keyword">end</span> - <span class="ruby-identifier">result</span> = <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">s</span> - <span class="ruby-identifier">result</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>) + <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">kv</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/\$\{#{kv[0]}\}/</span>, <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>) + <span class="ruby-keyword">end</span> + <span class="ruby-identifier">result</span> = <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">s</span> + <span class="ruby-identifier">result</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1894,34 +1894,34 @@ <div class="method-source-code" id="with_vars-source"> <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 713</span> -<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>) - <span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span> - <span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>) - <span class="ruby-identifier">ret_vars</span> = <span class="ruby-keyword">nil</span> - - <span class="ruby-identifier">ret</span> = <span class="ruby-keyword">yield</span> - - <span class="ruby-identifier">returned</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__RETURN__&#39;</span>] - <span class="ruby-keyword">if</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">==</span> [<span class="ruby-string">&#39;*&#39;</span>] - <span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">clone</span> - <span class="ruby-identifier">ret_vars</span>.<span class="ruby-identifier">delete</span> <span class="ruby-string">&#39;__RETURN__&#39;</span> - <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> - <span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">select</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">returned</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">k</span> } - <span class="ruby-keyword">end</span> -<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> - <span class="ruby-identifier">e</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-string">&quot;@variables&quot;</span>, <span class="ruby-ivar">@variables</span> - <span class="ruby-keyword">def</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span> - <span class="ruby-ivar">@variables</span> - <span class="ruby-keyword">end</span> - <span class="ruby-identifier">raise</span> -<span class="ruby-keyword">ensure</span> - <span class="ruby-ivar">@variables</span> = <span class="ruby-identifier">current</span> - <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">ret_vars</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_vars</span> - <span class="ruby-identifier">ret</span> +<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>) + <span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span> + <span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>) + <span class="ruby-identifier">ret_vars</span> = <span class="ruby-keyword">nil</span> + + <span class="ruby-identifier">ret</span> = <span class="ruby-keyword">yield</span> + + <span class="ruby-identifier">returned</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">&#39;__RETURN__&#39;</span>] + <span class="ruby-keyword">if</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">==</span> [<span class="ruby-string">&#39;*&#39;</span>] + <span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">clone</span> + <span class="ruby-identifier">ret_vars</span>.<span class="ruby-identifier">delete</span> <span class="ruby-string">&#39;__RETURN__&#39;</span> + <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> + <span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">select</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">returned</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">k</span> } + <span class="ruby-keyword">end</span> +<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">e</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-string">&quot;@variables&quot;</span>, <span class="ruby-ivar">@variables</span> + <span class="ruby-keyword">def</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span> + <span class="ruby-ivar">@variables</span> + <span class="ruby-keyword">end</span> + <span class="ruby-identifier">raise</span> +<span class="ruby-keyword">ensure</span> + <span class="ruby-ivar">@variables</span> = <span class="ruby-identifier">current</span> + <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">ret_vars</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_vars</span> + <span class="ruby-identifier">ret</span> <span class="ruby-keyword">end</span></pre> </div> </div> @@ -1937,9 +1937,9 @@ </main> <footer id="validator-badges" role="contentinfo"> <p><a href="http://validator.w3.org/check/referer">Validate</a> - <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2. - <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. + <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0. + <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. </footer>