doc/rdoc/more/classes/Argvector.html in facets-2.4.5 vs doc/rdoc/more/classes/Argvector.html in facets-2.5.0

- old
+ new

@@ -76,11 +76,11 @@ <div id="content"> <div class="description"><h1><a href="Argvector.html">Argvector</a></h1> <p> <a href="Argvector.html">Argvector</a> provides a very simple means of -parsing command line <a href="Argvector.html#M000433">arguments</a>. +parsing command line <a href="Argvector.html#M000421">arguments</a>. </p> <p> Unlike other more complex libs this provides only the most basic and standard parsing functionality. In many cases that&#8216;s all one really needs. @@ -101,24 +101,24 @@ </div> <div class="sectiontitle">Methods</div> - <span style="padding-right: 5px;"><a href="#M000433">arguments</a></span> - <span style="padding-right: 5px;"><a href="#M000436">flags</a></span> - <span style="padding-right: 5px;"><a href="#M000431">new</a></span> - <span style="padding-right: 5px;"><a href="#M000432">operands</a></span> - <span style="padding-right: 5px;"><a href="#M000434">options</a></span> - <span style="padding-right: 5px;"><a href="#M000435">parameters</a></span> - <span style="padding-right: 5px;"><a href="#M000430">parameters</a></span> - <span style="padding-right: 5px;"><a href="#M000443">parameters_without_duplicates</a></span> - <span style="padding-right: 5px;"><a href="#M000442">preflags</a></span> - <span style="padding-right: 5px;"><a href="#M000441">preoptions</a></span> - <span style="padding-right: 5px;"><a href="#M000438">subcommand</a></span> - <span style="padding-right: 5px;"><a href="#M000440">subcommand_with_arguments</a></span> - <span style="padding-right: 5px;"><a href="#M000437">subcommand_with_parameters</a></span> - <span style="padding-right: 5px;"><a href="#M000439">subcommand_with_preoptions</a></span> + <span style="padding-right: 5px;"><a href="#M000421">arguments</a></span> + <span style="padding-right: 5px;"><a href="#M000424">flags</a></span> + <span style="padding-right: 5px;"><a href="#M000419">new</a></span> + <span style="padding-right: 5px;"><a href="#M000420">operands</a></span> + <span style="padding-right: 5px;"><a href="#M000422">options</a></span> + <span style="padding-right: 5px;"><a href="#M000423">parameters</a></span> + <span style="padding-right: 5px;"><a href="#M000418">parameters</a></span> + <span style="padding-right: 5px;"><a href="#M000431">parameters_without_duplicates</a></span> + <span style="padding-right: 5px;"><a href="#M000430">preflags</a></span> + <span style="padding-right: 5px;"><a href="#M000429">preoptions</a></span> + <span style="padding-right: 5px;"><a href="#M000426">subcommand</a></span> + <span style="padding-right: 5px;"><a href="#M000428">subcommand_with_arguments</a></span> + <span style="padding-right: 5px;"><a href="#M000425">subcommand_with_parameters</a></span> + <span style="padding-right: 5px;"><a href="#M000427">subcommand_with_preoptions</a></span> @@ -148,23 +148,23 @@ </table> <div class="sectiontitle">Public Class methods</div> <div class="method"> <div class="title"> - <a name="M000431"></a><b>new</b>(line=nil, arity=nil) + <a name="M000419"></a><b>new</b>(line=nil, arity=nil) </div> <div class="description"> <p> Takes the command line string (or array) and <a -href="Argvector.html#M000434">options</a>. Options have <a -href="Argvector.html#M000436">flags</a> and end with a hash of option +href="Argvector.html#M000422">options</a>. Options have <a +href="Argvector.html#M000424">flags</a> and end with a hash of option arity. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000431_source')" id="l_M000431_source">+</a> ]</p> - <div id="M000431_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000419_source')" id="l_M000419_source">+</a> ]</p> + <div id="M000419_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 81</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">line</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">arity</span>=<span class="ruby-keyword kw">nil</span>) <span class="ruby-ivar">@line</span>, <span class="ruby-ivar">@argv</span> = <span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>) <span class="ruby-ivar">@arity</span> = <span class="ruby-identifier">parse_arity</span>(<span class="ruby-identifier">arity</span><span class="ruby-operator">||</span>{}) @@ -174,15 +174,15 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000430"></a><b>parameters</b>(*args) + <a name="M000418"></a><b>parameters</b>(*args) </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000430_source')" id="l_M000430_source">+</a> ]</p> - <div id="M000430_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000418_source')" id="l_M000418_source">+</a> ]</p> + <div id="M000418_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 67</span> <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parameters</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) <span class="ruby-identifier">new</span>.<span class="ruby-identifier">parameters</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) <span class="ruby-keyword kw">end</span> @@ -191,31 +191,31 @@ </div> </div> <div class="sectiontitle">Public Instance methods</div> <div class="method"> <div class="title"> - <a name="M000433"></a><b>arguments</b>() + <a name="M000421"></a><b>arguments</b>() </div> <div class="description"> <p> -Alias for <a href="Argvector.html#M000432">operands</a> +Alias for <a href="Argvector.html#M000420">operands</a> </p> </div> </div> <div class="method"> <div class="title"> - <a name="M000436"></a><b>flags</b>() + <a name="M000424"></a><b>flags</b>() </div> <div class="description"> <p> -Return <a href="Argvector.html#M000436">flags</a>, which are true <a -href="Argvector.html#M000434">options</a>. +Return <a href="Argvector.html#M000424">flags</a>, which are true <a +href="Argvector.html#M000422">options</a>. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000436_source')" id="l_M000436_source">+</a> ]</p> - <div id="M000436_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000424_source')" id="l_M000424_source">+</a> ]</p> + <div id="M000424_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 113</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flags</span> <span class="ruby-identifier">f</span> = [] <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> @@ -229,24 +229,24 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000432"></a><b>operands</b>() + <a name="M000420"></a><b>operands</b>() </div> <div class="description"> <p> Returns operand array. </p> </div> <div class="aka"> This method is also aliased as - <a href="Argvector.html#M000433">arguments</a> + <a href="Argvector.html#M000421">arguments</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000432_source')" id="l_M000432_source">+</a> ]</p> - <div id="M000432_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000420_source')" id="l_M000420_source">+</a> ]</p> + <div id="M000420_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 91</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">operands</span> <span class="ruby-ivar">@operands</span> <span class="ruby-keyword kw">end</span> @@ -254,20 +254,20 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000434"></a><b>options</b>() + <a name="M000422"></a><b>options</b>() </div> <div class="description"> <p> -Returns <a href="Argvector.html#M000434">options</a> hash. +Returns <a href="Argvector.html#M000422">options</a> hash. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000434_source')" id="l_M000434_source">+</a> ]</p> - <div id="M000434_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000422_source')" id="l_M000422_source">+</a> ]</p> + <div id="M000422_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 100</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span> <span class="ruby-ivar">@options</span> <span class="ruby-keyword kw">end</span> @@ -275,22 +275,22 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000435"></a><b>parameters</b>() + <a name="M000423"></a><b>parameters</b>() </div> <div class="description"> <p> -Returns [<a href="Argvector.html#M000432">operands</a>, <a -href="Argvector.html#M000434">options</a>], which is good for plugging +Returns [<a href="Argvector.html#M000420">operands</a>, <a +href="Argvector.html#M000422">options</a>], which is good for plugging directly into a method. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000435_source')" id="l_M000435_source">+</a> ]</p> - <div id="M000435_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000423_source')" id="l_M000423_source">+</a> ]</p> + <div id="M000423_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 107</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parameters</span> <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@operands</span>, <span class="ruby-ivar">@options</span> <span class="ruby-keyword kw">end</span> @@ -298,21 +298,21 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000443"></a><b>parameters_without_duplicates</b>() + <a name="M000431"></a><b>parameters_without_duplicates</b>() </div> <div class="description"> <p> -Like <a href="Argvector.html#M000430">parameters</a> but without allowing -for duplicate <a href="Argvector.html#M000434">options</a>. +Like <a href="Argvector.html#M000418">parameters</a> but without allowing +for duplicate <a href="Argvector.html#M000422">options</a>. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000443_source')" id="l_M000443_source">+</a> ]</p> - <div id="M000443_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000431_source')" id="l_M000431_source">+</a> ]</p> + <div id="M000431_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 188</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parameters_without_duplicates</span> <span class="ruby-identifier">opts</span> = {} <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> @@ -328,22 +328,22 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000442"></a><b>preflags</b>() + <a name="M000430"></a><b>preflags</b>() </div> <div class="description"> <p> -Same as <tt><a href="Argvector.html#M000436">flags</a></tt> but only -returns <a href="Argvector.html#M000436">flags</a> in the <a -href="Argvector.html#M000441">preoptions</a>. +Same as <tt><a href="Argvector.html#M000424">flags</a></tt> but only +returns <a href="Argvector.html#M000424">flags</a> in the <a +href="Argvector.html#M000429">preoptions</a>. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000442_source')" id="l_M000442_source">+</a> ]</p> - <div id="M000442_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000430_source')" id="l_M000430_source">+</a> ]</p> + <div id="M000430_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 175</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">preflags</span> <span class="ruby-identifier">preopts</span>, <span class="ruby-identifier">remainder</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">parse_preoptions</span>(<span class="ruby-identifier">argv</span>) <span class="ruby-identifier">f</span> = [] @@ -358,29 +358,29 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000441"></a><b>preoptions</b>() + <a name="M000429"></a><b>preoptions</b>() </div> <div class="description"> <p> -Returns a hash of <a href="Argvector.html#M000434">options</a> that occur +Returns a hash of <a href="Argvector.html#M000422">options</a> that occur before the first operand. This works well with <a -href="Argvector.html#M000438">subcommand</a> to get the main -command&#8216;s <a href="Argvector.html#M000434">options</a>. +href="Argvector.html#M000426">subcommand</a> to get the main +command&#8216;s <a href="Argvector.html#M000422">options</a>. </p> <pre> line = &quot;--trace stamp --file VERSION&quot; cargs = Argvector.new(line) opts = cargs.preoptions opts #=&gt; {&quot;trace&quot;=&gt;true} </pre> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000441_source')" id="l_M000441_source">+</a> ]</p> - <div id="M000441_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000429_source')" id="l_M000429_source">+</a> ]</p> + <div id="M000429_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 167</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">preoptions</span> <span class="ruby-identifier">preopts</span>, <span class="ruby-identifier">remainder</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">parse_preoptions</span>(<span class="ruby-identifier">argv</span>) <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">preopts</span> @@ -389,36 +389,36 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000438"></a><b>subcommand</b>() + <a name="M000426"></a><b>subcommand</b>() </div> <div class="description"> <p> -Alias for <a href="Argvector.html#M000437">subcommand_with_parameters</a> +Alias for <a href="Argvector.html#M000425">subcommand_with_parameters</a> </p> </div> </div> <div class="method"> <div class="title"> - <a name="M000440"></a><b>subcommand_with_arguments</b>() + <a name="M000428"></a><b>subcommand_with_arguments</b>() </div> <div class="description"> <p> Assumes the first operand is a &quot;<a -href="Argvector.html#M000438">subcommand</a>&quot; and returns it and the +href="Argvector.html#M000426">subcommand</a>&quot; and returns it and the argments following it as another Arguments object. </p> <p> TODO: This probably should be called &#8216;<a -href="Argvector.html#M000438">subcommand</a>&#8217;. +href="Argvector.html#M000426">subcommand</a>&#8217;. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000440_source')" id="l_M000440_source">+</a> ]</p> - <div id="M000440_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000428_source')" id="l_M000428_source">+</a> ]</p> + <div id="M000428_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 151</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subcommand_with_arguments</span> <span class="ruby-identifier">opts</span>, <span class="ruby-identifier">args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">parse_preoptions</span>(<span class="ruby-identifier">argv</span>) <span class="ruby-identifier">cmd</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span> @@ -429,26 +429,26 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000437"></a><b>subcommand_with_parameters</b>() + <a name="M000425"></a><b>subcommand_with_parameters</b>() </div> <div class="description"> <p> Assumes the first operand is a &quot;<a -href="Argvector.html#M000438">subcommand</a>&quot; and returns it and the -argments following it as <a href="Argvector.html#M000430">parameters</a>. +href="Argvector.html#M000426">subcommand</a>&quot; and returns it and the +argments following it as <a href="Argvector.html#M000418">parameters</a>. </p> </div> <div class="aka"> This method is also aliased as - <a href="Argvector.html#M000438">subcommand</a> + <a href="Argvector.html#M000426">subcommand</a> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000437_source')" id="l_M000437_source">+</a> ]</p> - <div id="M000437_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000425_source')" id="l_M000425_source">+</a> ]</p> + <div id="M000425_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 127</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subcommand_with_parameters</span> <span class="ruby-identifier">opts</span>, <span class="ruby-identifier">args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">parse_preoptions</span>(<span class="ruby-identifier">argv</span>) <span class="ruby-identifier">cmd</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span> @@ -459,14 +459,14 @@ </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000439"></a><b>subcommand_with_preoptions</b>() + <a name="M000427"></a><b>subcommand_with_preoptions</b>() </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000439_source')" id="l_M000439_source">+</a> ]</p> - <div id="M000439_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000427_source')" id="l_M000427_source">+</a> ]</p> + <div id="M000427_source" class="dyn-source"> <pre> <span class="ruby-comment cmt"># File lib/more/facets/argvector.rb, line 137</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subcommand_with_preoptions</span> <span class="ruby-identifier">pre</span>, <span class="ruby-identifier">args</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">parse_preoptions</span>(<span class="ruby-identifier">argv</span>) <span class="ruby-identifier">cmd</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span> \ No newline at end of file