doc/TermUtils/AP/Parser.html in term_utils-0.3.2 vs doc/TermUtils/AP/Parser.html in term_utils-0.4.0
- old
+ new
@@ -4,19 +4,19 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: TermUtils::AP::Parser
- — Documentation by YARD 0.9.20
+ — Documentation by YARD 0.9.25
</title>
- <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
- <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
-<script type="text/javascript" charset="utf-8">
+<script type="text/javascript">
pathId = "TermUtils::AP::Parser";
relpath = '../../';
</script>
@@ -117,70 +117,103 @@
<h2>
- Instance Method Summary
+ Class Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Parser </a>
+ <a href="#eval_article_min_occurs-class_method" title="eval_article_min_occurs (class method)">.<strong>eval_article_min_occurs</strong>(articles) ⇒ Integer </a>
</span>
- <span class="note title constructor">constructor</span>
+
+ <span class="summary_desc"><div class='inline'>
+<p>Evaluates the added number of min occurs of a given array of articles.</p>
+</div></span>
+
+</li>
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#match_shortcut_flag-class_method" title="match_shortcut_flag (class method)">.<strong>match_shortcut_flag</strong>(shortcut_flags, arg) ⇒ Array<String><sup>?</sup> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
<span class="summary_desc"><div class='inline'>
-<p>A new instance of Parser.</p>
+<p>Tests whether a given sample matches a shortcut flag.</p>
</div></span>
</li>
+ </ul>
+
+ <h2>
+ Instance Method Summary
+ <small><a href="#" class="summary_toggle">collapse</a></small>
+ </h2>
+
+ <ul class="summary">
+
<li class="public ">
<span class="summary_signature">
- <a href="#parse_arguments-instance_method" title="#parse_arguments (instance method)">#<strong>parse_arguments</strong>(syntax, arguments, opts = {}) ⇒ TermUtils::AP::Result </a>
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Parser </a>
</span>
+ <span class="note title constructor">constructor</span>
+
<span class="summary_desc"><div class='inline'>
-<p>Parses a given list of arguments.</p>
+<p>Constructs a new Parser.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#parse_command-instance_method" title="#parse_command (instance method)">#<strong>parse_command</strong>(syntax, command, opts = {}) ⇒ TermUtils::AP::Result </a>
+ <a href="#parse_arguments-instance_method" title="#parse_arguments (instance method)">#<strong>parse_arguments</strong>(syntax, arguments, opts = {}, &block) ⇒ Result </a>
</span>
@@ -191,11 +224,11 @@
<span class="summary_desc"><div class='inline'>
-<p>Parses a given command.</p>
+<p>Parses a given list of arguments.</p>
</div></span>
</li>
@@ -215,11 +248,11 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Returns a new instance of Parser</p>
+<p>Constructs a new Parser.</p>
</div>
</div>
<div class="tags">
@@ -229,15 +262,15 @@
<tr>
<td>
<pre class="lines">
-22
-23</pre>
+24
+25</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 22</span>
+ <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 24</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='kw'>end</span></pre>
</td>
</tr>
@@ -245,187 +278,199 @@
</div>
</div>
- <div id="instance_method_details" class="method_details_list">
- <h2>Instance Method Details</h2>
+ <div id="class_method_details" class="method_details_list">
+ <h2>Class Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="parse_arguments-instance_method">
+ <h3 class="signature first" id="eval_article_min_occurs-class_method">
- #<strong>parse_arguments</strong>(syntax, arguments, opts = {}) ⇒ <tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>
+ .<strong>eval_article_min_occurs</strong>(articles) ⇒ <tt>Integer</tt>
</h3><div class="docstring">
<div class="discussion">
-<p>Parses a given list of arguments.</p>
+<p>Evaluates the added number of min occurs of a given array of articles.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
- <span class='name'>syntax</span>
+ <span class='name'>articles</span>
- <span class='type'>(<tt><span class='object_link'><a href="Syntax.html" title="TermUtils::AP::Syntax (class)">TermUtils::AP::Syntax</a></span></tt>)</span>
+ <span class='type'>(<tt>Array<<span class='object_link'><a href="Article.html" title="TermUtils::AP::Article (class)">TermUtils::AP::Article</a></span>></tt>)</span>
</li>
- <li>
-
- <span class='name'>arguments</span>
-
-
- <span class='type'>(<tt>Array<String></tt>)</span>
-
-
-
- </li>
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
<li>
- <span class='name'>opts</span>
+ <span class='type'>(<tt>Integer</tt>)</span>
- <span class='type'>(<tt>Hash</tt>)</span>
- <em class="default">(defaults to: <tt>{}</tt>)</em>
-
-
- —
- <div class='inline'>
-<p>`:program`.</p>
-</div>
-
</li>
</ul>
-
-
-
-
-
-
-
- <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
- <ul class="option">
-
- <li>
- <span class="name">:program</span>
- <span class="type">(<tt>Boolean</tt>)</span>
- <span class="default">
-
- </span>
-
- — <div class='inline'>
-<p>Whether the first argument is the program name.</p>
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+64
+65
+66</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 64</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_eval_article_min_occurs'>eval_article_min_occurs</span><span class='lparen'>(</span><span class='id identifier rubyid_articles'>articles</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_articles'>articles</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_acc'>acc</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_acc'>acc</span> <span class='op'>+</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_min_occurs'>min_occurs</span> <span class='rbrace'>}</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
</div>
-
- </li>
-
- </ul>
+
+ <div class="method_details ">
+ <h3 class="signature " id="match_shortcut_flag-class_method">
+ .<strong>match_shortcut_flag</strong>(shortcut_flags, arg) ⇒ <tt>Array<String></tt><sup>?</sup>
+
-<p class="tag_title">Returns:</p>
-<ul class="return">
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Tests whether a given sample matches a shortcut flag.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
<li>
+ <span class='name'>shortcut_flags</span>
- <span class='type'>(<tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>)</span>
+ <span class='type'>(<tt>Hash<String, <span class='object_link'><a href="Flag.html" title="TermUtils::AP::Flag (class)">Flag</a></span>></tt>)</span>
+
</li>
-</ul>
-<p class="tag_title">Raises:</p>
-<ul class="raise">
-
<li>
+ <span class='name'>arg</span>
- <span class='type'>(<tt><span class='object_link'><a href="ParseError.html" title="TermUtils::AP::ParseError (class)">TermUtils::AP::ParseError</a></span></tt>)</span>
+ <span class='type'>(<tt>String</tt>)</span>
+
</li>
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
<li>
- <span class='type'>(<tt><span class='object_link'><a href="SyntaxError.html" title="TermUtils::AP::SyntaxError (class)">TermUtils::AP::SyntaxError</a></span></tt>)</span>
+ <span class='type'>(<tt>Array<String></tt>, <tt>nil</tt>)</span>
+ —
+ <div class='inline'>
+<p>Replacements on success, nil otherwise.</p>
+</div>
+
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-43
-44
-45
-46
-47
-48
-49
-50
51
-52</pre>
+52
+53
+54
+55
+56
+57
+58
+59</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 43</span>
+ <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 51</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_parse_arguments'>parse_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_syntax'>syntax</span> <span class='op'>=</span> <span class='id identifier rubyid_syntax'>syntax</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
- <span class='id identifier rubyid_syntax'>syntax</span><span class='period'>.</span><span class='id identifier rubyid_finalize!'>finalize!</span>
- <span class='id identifier rubyid_arguments'>arguments</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
- <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../AP.html" title="TermUtils::AP (module)">AP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">Result</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Result.html#initialize-instance_method" title="TermUtils::AP::Result#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_catch'>catch</span> <span class='symbol'>:done</span> <span class='kw'>do</span>
- <span class='id identifier rubyid_parse0'>parse0</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match_shortcut_flag'>match_shortcut_flag</span><span class='lparen'>(</span><span class='id identifier rubyid_shortcut_flags'>shortcut_flags</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_shortcut_flags'>shortcut_flags</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_label'>label</span><span class='comma'>,</span> <span class='id identifier rubyid_flag'>flag</span><span class='op'>|</span>
+ <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_arg'>arg</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span> <span class='id identifier rubyid_label'>label</span>
+
+ <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_flag'>flag</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='lbracket'>[</span><span class='id identifier rubyid_label'>label</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
<span class='kw'>end</span>
- <span class='id identifier rubyid_res'>res</span>
+
+ <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
- <div class="method_details ">
- <h3 class="signature " id="parse_command-instance_method">
+ </div>
+
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="parse_arguments-instance_method">
- #<strong>parse_command</strong>(syntax, command, opts = {}) ⇒ <tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>
+ #<strong>parse_arguments</strong>(syntax, arguments, opts = {}, &block) ⇒ <tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">Result</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
-<p>Parses a given command.</p>
+<p>Parses a given list of arguments.</p>
</div>
</div>
<div class="tags">
@@ -435,22 +480,22 @@
<li>
<span class='name'>syntax</span>
- <span class='type'>(<tt><span class='object_link'><a href="Syntax.html" title="TermUtils::AP::Syntax (class)">TermUtils::AP::Syntax</a></span></tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="Syntax.html" title="TermUtils::AP::Syntax (class)">Syntax</a></span></tt>)</span>
</li>
<li>
- <span class='name'>command</span>
+ <span class='name'>arguments</span>
- <span class='type'>(<tt>String</tt>)</span>
+ <span class='type'>(<tt>Array<String></tt>)</span>
</li>
@@ -463,52 +508,21 @@
<em class="default">(defaults to: <tt>{}</tt>)</em>
- —
- <div class='inline'>
-<p>`:program`.</p>
-</div>
-
</li>
</ul>
-
-
-
-
-
-
-
- <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
- <ul class="option">
-
- <li>
- <span class="name">:program</span>
- <span class="type">(<tt>Boolean</tt>)</span>
- <span class="default">
-
- </span>
-
- — <div class='inline'>
-<p>Whether the first argument is the program name.</p>
-</div>
-
- </li>
-
- </ul>
-
-
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
- <span class='type'>(<tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">Result</a></span></tt>)</span>
</li>
@@ -517,20 +531,20 @@
<ul class="raise">
<li>
- <span class='type'>(<tt><span class='object_link'><a href="ParseError.html" title="TermUtils::AP::ParseError (class)">TermUtils::AP::ParseError</a></span></tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="ParseError.html" title="TermUtils::AP::ParseError (class)">ParseError</a></span></tt>)</span>
</li>
<li>
- <span class='type'>(<tt><span class='object_link'><a href="SyntaxError.html" title="TermUtils::AP::SyntaxError (class)">TermUtils::AP::SyntaxError</a></span></tt>)</span>
+ <span class='type'>(<tt><span class='object_link'><a href="SyntaxError.html" title="TermUtils::AP::SyntaxError (class)">SyntaxError</a></span></tt>)</span>
</li>
@@ -540,19 +554,37 @@
<tr>
<td>
<pre class="lines">
-32
-33
-34</pre>
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 32</span>
+ <pre class="code"><span class="info file"># File 'lib/term_utils/ap/parser.rb', line 34</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_parse_command'>parse_command</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_parse_arguments'>parse_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_parse_arguments'>parse_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_syntax'>syntax</span> <span class='op'>=</span> <span class='id identifier rubyid_syntax'>syntax</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
+ <span class='id identifier rubyid_syntax'>syntax</span><span class='period'>.</span><span class='id identifier rubyid_finalize!'>finalize!</span>
+ <span class='id identifier rubyid_arguments'>arguments</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../AP.html" title="TermUtils::AP (module)">AP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Result.html" title="TermUtils::AP::Result (class)">Result</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Result.html#initialize-instance_method" title="TermUtils::AP::Result#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_catch'>catch</span> <span class='symbol'>:done</span> <span class='kw'>do</span>
+ <span class='id identifier rubyid_parse0'>parse0</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='comma'>,</span> <span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+ <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_remaining_arguments'>remaining_arguments</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span>
+ <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_walk'>walk</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
+ <span class='id identifier rubyid_res'>res</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -560,12 +592,12 @@
</div>
</div>
<div id="footer">
- Generated on Fri Feb 7 18:54:40 2020 by
+ Generated on Sun Aug 2 18:35:09 2020 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.9.20 (ruby-2.6.5).
+ 0.9.25 (ruby-2.6.5).
</div>
</div>
</body>
</html>
\ No newline at end of file