doc/Bauxite/Context.html in bauxite-0.4.0 vs doc/Bauxite/Context.html in bauxite-0.4.1

- old
+ new

@@ -293,11 +293,11 @@ <div class="method-source-code" id="new-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 68</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 69</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>, @@ -355,11 +355,11 @@ <div class="method-source-code" id="debug-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 175</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 176</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-string">&#39;debug&#39;</span>, <span class="ruby-keyword">false</span>) <span class="ruby-keyword">end</span></pre> </div> @@ -412,11 +412,11 @@ <div class="method-source-code" id="find-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 164</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 165</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-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> @@ -462,11 +462,11 @@ <div class="method-source-code" id="get_value-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 194</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 195</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> @@ -505,11 +505,11 @@ <div class="method-source-code" id="reset_driver-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 119</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 120</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-identifier">_load_driver</span> <span class="ruby-keyword">end</span></pre> </div> @@ -554,11 +554,11 @@ <div class="method-source-code" id="start-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 101</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 102</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = []) <span class="ruby-identifier">_load_driver</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> @@ -613,11 +613,11 @@ <div class="method-source-code" id="stop-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 139</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 140</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-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">end</span></pre> </div> @@ -679,11 +679,11 @@ <div class="method-source-code" id="load_logger-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 315</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 316</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</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> @@ -721,11 +721,11 @@ <div class="method-source-code" id="parse_action_default-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 337</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 338</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> = [] @@ -789,11 +789,11 @@ <div class="method-source-code" id="wait-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 308</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 309</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> @@ -831,11 +831,11 @@ <div class="method-source-code" id="add_alias-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 331</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 332</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> @@ -874,11 +874,11 @@ <div class="method-source-code" id="exec_action-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 215</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 216</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</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-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-identifier">file</span>, <span class="ruby-identifier">line</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-identifier">text</span>, <span class="ruby-identifier">log</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>) <span class="ruby-keyword">end</span></pre> </div> @@ -914,11 +914,11 @@ <div class="method-source-code" id="exec_file-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 226</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 227</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</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-identifier">_exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span></pre> @@ -969,11 +969,11 @@ <div class="method-source-code" id="handle_errors-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 251</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 252</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">handle_errors</span>(<span class="ruby-identifier">break_into_debug</span> = <span class="ruby-keyword">false</span>, <span class="ruby-identifier">exit_on_error</span> = <span class="ruby-keyword">true</span>) <span class="ruby-keyword">yield</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-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> @@ -1034,11 +1034,11 @@ <div class="method-source-code" id="with_timeout-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 287</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 288</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> @@ -1115,11 +1115,11 @@ <div class="method-source-code" id="action_args-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 390</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 391</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> @@ -1155,11 +1155,11 @@ <div class="method-source-code" id="actions-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 380</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 381</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> @@ -1194,11 +1194,11 @@ <div class="method-source-code" id="loggers-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 419</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 420</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> @@ -1236,11 +1236,11 @@ <div class="method-source-code" id="max_action_name_size-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 443</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 444</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> @@ -1275,11 +1275,11 @@ <div class="method-source-code" id="parsers-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 429</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 430</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> @@ -1319,11 +1319,11 @@ <div class="method-source-code" id="selectors-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 405</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 406</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> @@ -1401,11 +1401,11 @@ <div class="method-source-code" id="expand-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 464</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 465</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> @@ -1454,11 +1454,11 @@ <div class="method-source-code" id="with_vars-source"> - <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 487</span> + <pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 488</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-keyword">yield</span> <span class="ruby-keyword">ensure</span> @@ -1480,9 +1480,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.0. + <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1. <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. </footer>