term_utils 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/COPYING +3 -3
- data/README.md +7 -1
- data/doc/TermUtils/AP/Article.html +991 -0
- data/doc/TermUtils/AP/Element.html +1025 -0
- data/doc/TermUtils/AP/Flag.html +539 -0
- data/doc/TermUtils/AP/Level.html +638 -0
- data/doc/TermUtils/AP/NoSuchValueError.html +217 -0
- data/doc/TermUtils/AP/Parameter.html +804 -0
- data/doc/TermUtils/AP/ParseError.html +217 -0
- data/doc/TermUtils/AP/Parser.html +572 -0
- data/doc/TermUtils/AP/Result.html +1029 -0
- data/doc/TermUtils/AP/ResultView.html +597 -0
- data/doc/TermUtils/AP/Syntax.html +1051 -0
- data/doc/TermUtils/AP/SyntaxError.html +217 -0
- data/doc/TermUtils/AP.html +505 -0
- data/doc/TermUtils/FF/Config.html +1 -1
- data/doc/TermUtils/FF/Cursor/Context.html +1 -1
- data/doc/TermUtils/FF/Cursor.html +1 -1
- data/doc/TermUtils/FF/Query.html +1 -1
- data/doc/TermUtils/FF.html +1 -1
- data/doc/TermUtils/PropertyTreeNode.html +1999 -0
- data/doc/TermUtils/Tab/Column.html +1 -1
- data/doc/TermUtils/Tab/Holder.html +1 -1
- data/doc/TermUtils/Tab/Printer.html +1 -1
- data/doc/TermUtils/Tab/Table.html +1 -1
- data/doc/TermUtils/Tab.html +1 -1
- data/doc/TermUtils.html +5 -3
- data/doc/_index.html +143 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +8 -2
- data/doc/index.html +8 -2
- data/doc/method_list.html +638 -22
- data/doc/top-level-namespace.html +1 -1
- data/lib/term_utils/ap/article.rb +68 -0
- data/lib/term_utils/ap/element.rb +78 -0
- data/lib/term_utils/ap/flag.rb +48 -0
- data/lib/term_utils/ap/level.rb +57 -0
- data/lib/term_utils/ap/no_such_value_error.rb +27 -0
- data/lib/term_utils/ap/parameter.rb +75 -0
- data/lib/term_utils/ap/parse_error.rb +27 -0
- data/lib/term_utils/ap/parser.rb +185 -0
- data/lib/term_utils/ap/result.rb +175 -0
- data/lib/term_utils/ap/syntax.rb +112 -0
- data/lib/term_utils/ap/syntax_error.rb +27 -0
- data/lib/term_utils/ap.rb +59 -0
- data/lib/term_utils/property_tree_node.rb +200 -0
- data/lib/term_utils.rb +1 -0
- data/term_utils.gemspec +2 -2
- metadata +29 -2
@@ -0,0 +1,1029 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: TermUtils::AP::Result
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "TermUtils::AP::Result";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (R)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span> » <span class='title'><span class='object_link'><a href="../AP.html" title="TermUtils::AP (module)">AP</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Result</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: TermUtils::AP::Result
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">TermUtils::AP::Result</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/term_utils/ap/result.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Represents an argument parsing Result.</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
118
|
+
<ul class="summary">
|
119
|
+
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#value-instance_method" title="#value (instance method)">#<strong>value</strong> ⇒ TermUtils::PropertyTreeNode </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
</ul>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<h2>
|
152
|
+
Instance Method Summary
|
153
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
154
|
+
</h2>
|
155
|
+
|
156
|
+
<ul class="summary">
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#eval_occurs-instance_method" title="#eval_occurs (instance method)">#<strong>eval_occurs</strong>(id) ⇒ Integer </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<span class="summary_desc"><div class='inline'>
|
176
|
+
<p>Evaluates the number of occurrences of a given level, parameter or article.</p>
|
177
|
+
</div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#fetch_value-instance_method" title="#fetch_value (instance method)">#<strong>fetch_value</strong>(id, opts = {}) ⇒ Object </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<span class="summary_desc"><div class='inline'>
|
200
|
+
<p>Fetches a value.</p>
|
201
|
+
</div></span>
|
202
|
+
|
203
|
+
</li>
|
204
|
+
|
205
|
+
|
206
|
+
<li class="public ">
|
207
|
+
<span class="summary_signature">
|
208
|
+
|
209
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(syntax, element = nil, value = nil) ⇒ Result </a>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</span>
|
214
|
+
|
215
|
+
|
216
|
+
<span class="note title constructor">constructor</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<span class="summary_desc"><div class='inline'>
|
226
|
+
<p>Constructs a new Result.</p>
|
227
|
+
</div></span>
|
228
|
+
|
229
|
+
</li>
|
230
|
+
|
231
|
+
|
232
|
+
<li class="public ">
|
233
|
+
<span class="summary_signature">
|
234
|
+
|
235
|
+
<a href="#present%3F-instance_method" title="#present? (instance method)">#<strong>present?</strong>(id) ⇒ Boolean </a>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</span>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<span class="summary_desc"><div class='inline'>
|
250
|
+
<p>Tests whether a given level/parameter/article is present in the result value.</p>
|
251
|
+
</div></span>
|
252
|
+
|
253
|
+
</li>
|
254
|
+
|
255
|
+
|
256
|
+
<li class="public ">
|
257
|
+
<span class="summary_signature">
|
258
|
+
|
259
|
+
<a href="#shift-instance_method" title="#shift (instance method)">#<strong>shift</strong>(id, opts = {}) ⇒ TermUtils::AP::Result </a>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<span class="summary_desc"><div class='inline'>
|
274
|
+
<p>Shifts this one.</p>
|
275
|
+
</div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
</ul>
|
281
|
+
|
282
|
+
|
283
|
+
<div id="constructor_details" class="method_details_list">
|
284
|
+
<h2>Constructor Details</h2>
|
285
|
+
|
286
|
+
<div class="method_details first">
|
287
|
+
<h3 class="signature first" id="initialize-instance_method">
|
288
|
+
|
289
|
+
#<strong>initialize</strong>(syntax, element = nil, value = nil) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::AP::Result (class)">Result</a></span></tt>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</h3><div class="docstring">
|
296
|
+
<div class="discussion">
|
297
|
+
|
298
|
+
<p>Constructs a new Result.</p>
|
299
|
+
|
300
|
+
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
<div class="tags">
|
304
|
+
<p class="tag_title">Parameters:</p>
|
305
|
+
<ul class="param">
|
306
|
+
|
307
|
+
<li>
|
308
|
+
|
309
|
+
<span class='name'>syntax</span>
|
310
|
+
|
311
|
+
|
312
|
+
<span class='type'>(<tt>Darn::AP::Syntax</tt>)</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
—
|
317
|
+
<div class='inline'>
|
318
|
+
<p>Syntax.</p>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
</li>
|
322
|
+
|
323
|
+
<li>
|
324
|
+
|
325
|
+
<span class='name'>element</span>
|
326
|
+
|
327
|
+
|
328
|
+
<span class='type'>(<tt>Darn::AP::Element</tt>)</span>
|
329
|
+
|
330
|
+
|
331
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
332
|
+
|
333
|
+
|
334
|
+
—
|
335
|
+
<div class='inline'>
|
336
|
+
<p>Optional Element.</p>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
</li>
|
340
|
+
|
341
|
+
<li>
|
342
|
+
|
343
|
+
<span class='name'>value</span>
|
344
|
+
|
345
|
+
|
346
|
+
<span class='type'>(<tt>Darn::PropertyTreeNode</tt>)</span>
|
347
|
+
|
348
|
+
|
349
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
350
|
+
|
351
|
+
|
352
|
+
—
|
353
|
+
<div class='inline'>
|
354
|
+
<p>Optional value.</p>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</li>
|
358
|
+
|
359
|
+
</ul>
|
360
|
+
|
361
|
+
|
362
|
+
</div><table class="source_code">
|
363
|
+
<tr>
|
364
|
+
<td>
|
365
|
+
<pre class="lines">
|
366
|
+
|
367
|
+
|
368
|
+
28
|
369
|
+
29
|
370
|
+
30
|
371
|
+
31
|
372
|
+
32
|
373
|
+
33
|
374
|
+
34
|
375
|
+
35
|
376
|
+
36
|
377
|
+
37</pre>
|
378
|
+
</td>
|
379
|
+
<td>
|
380
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 28</span>
|
381
|
+
|
382
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_element'>element</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
383
|
+
<span class='ivar'>@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>
|
384
|
+
<span class='ivar'>@element</span> <span class='op'>=</span> <span class='id identifier rubyid_element'>element</span> <span class='op'>?</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
385
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span>
|
386
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
387
|
+
<span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
388
|
+
<span class='kw'>else</span>
|
389
|
+
<span class='ivar'>@value</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="../PropertyTreeNode.html" title="TermUtils::PropertyTreeNode (class)">PropertyTreeNode</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../PropertyTreeNode.html#initialize-instance_method" title="TermUtils::PropertyTreeNode#initialize (method)">new</a></span></span>
|
390
|
+
<span class='kw'>end</span>
|
391
|
+
<span class='kw'>end</span></pre>
|
392
|
+
</td>
|
393
|
+
</tr>
|
394
|
+
</table>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
<div id="instance_attr_details" class="attr_details">
|
400
|
+
<h2>Instance Attribute Details</h2>
|
401
|
+
|
402
|
+
|
403
|
+
<span id="value=-instance_method"></span>
|
404
|
+
<div class="method_details first">
|
405
|
+
<h3 class="signature first" id="value-instance_method">
|
406
|
+
|
407
|
+
#<strong>value</strong> ⇒ <tt><span class='object_link'><a href="../PropertyTreeNode.html" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</h3><div class="docstring">
|
414
|
+
<div class="discussion">
|
415
|
+
|
416
|
+
|
417
|
+
</div>
|
418
|
+
</div>
|
419
|
+
<div class="tags">
|
420
|
+
|
421
|
+
<p class="tag_title">Returns:</p>
|
422
|
+
<ul class="return">
|
423
|
+
|
424
|
+
<li>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'>(<tt><span class='object_link'><a href="../PropertyTreeNode.html" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>)</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</li>
|
432
|
+
|
433
|
+
</ul>
|
434
|
+
|
435
|
+
</div><table class="source_code">
|
436
|
+
<tr>
|
437
|
+
<td>
|
438
|
+
<pre class="lines">
|
439
|
+
|
440
|
+
|
441
|
+
23
|
442
|
+
24
|
443
|
+
25</pre>
|
444
|
+
</td>
|
445
|
+
<td>
|
446
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 23</span>
|
447
|
+
|
448
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
449
|
+
<span class='ivar'>@value</span>
|
450
|
+
<span class='kw'>end</span></pre>
|
451
|
+
</td>
|
452
|
+
</tr>
|
453
|
+
</table>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
</div>
|
457
|
+
|
458
|
+
|
459
|
+
<div id="instance_method_details" class="method_details_list">
|
460
|
+
<h2>Instance Method Details</h2>
|
461
|
+
|
462
|
+
|
463
|
+
<div class="method_details first">
|
464
|
+
<h3 class="signature first" id="eval_occurs-instance_method">
|
465
|
+
|
466
|
+
#<strong>eval_occurs</strong>(id) ⇒ <tt>Integer</tt>
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
</h3><div class="docstring">
|
473
|
+
<div class="discussion">
|
474
|
+
|
475
|
+
<p>Evaluates the number of occurrences of a given level, parameter or article.</p>
|
476
|
+
|
477
|
+
|
478
|
+
</div>
|
479
|
+
</div>
|
480
|
+
<div class="tags">
|
481
|
+
<p class="tag_title">Parameters:</p>
|
482
|
+
<ul class="param">
|
483
|
+
|
484
|
+
<li>
|
485
|
+
|
486
|
+
<span class='name'>id</span>
|
487
|
+
|
488
|
+
|
489
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>Array<Symbol></tt>)</span>
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
</li>
|
494
|
+
|
495
|
+
</ul>
|
496
|
+
|
497
|
+
<p class="tag_title">Returns:</p>
|
498
|
+
<ul class="return">
|
499
|
+
|
500
|
+
<li>
|
501
|
+
|
502
|
+
|
503
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
</li>
|
508
|
+
|
509
|
+
</ul>
|
510
|
+
<p class="tag_title">Raises:</p>
|
511
|
+
<ul class="raise">
|
512
|
+
|
513
|
+
<li>
|
514
|
+
|
515
|
+
|
516
|
+
<span class='type'>(<tt><span class='object_link'><a href="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">TermUtils::AP::NoSuchValueError</a></span></tt>)</span>
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
</li>
|
521
|
+
|
522
|
+
</ul>
|
523
|
+
|
524
|
+
</div><table class="source_code">
|
525
|
+
<tr>
|
526
|
+
<td>
|
527
|
+
<pre class="lines">
|
528
|
+
|
529
|
+
|
530
|
+
51
|
531
|
+
52
|
532
|
+
53
|
533
|
+
54
|
534
|
+
55
|
535
|
+
56
|
536
|
+
57
|
537
|
+
58
|
538
|
+
59
|
539
|
+
60</pre>
|
540
|
+
</td>
|
541
|
+
<td>
|
542
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 51</span>
|
543
|
+
|
544
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_eval_occurs'>eval_occurs</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
545
|
+
<span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
546
|
+
<span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='id identifier rubyid_fetch_syntax_object'>fetch_syntax_object</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
547
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such syntax object</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_obj'>obj</span>
|
548
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
549
|
+
<span class='kw'>return</span> <span class='int'>0</span> <span class='kw'>unless</span> <span class='id identifier rubyid_node'>node</span>
|
550
|
+
<span class='kw'>return</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_occur_bounded?'>occur_bounded?</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_max_occurs'>max_occurs</span> <span class='op'>==</span> <span class='int'>1</span><span class='rparen'>)</span>
|
551
|
+
<span class='comment'># Parameter is multiple.
|
552
|
+
</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span> <span class='op'>?</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>:</span> <span class='int'>0</span>
|
553
|
+
<span class='kw'>end</span></pre>
|
554
|
+
</td>
|
555
|
+
</tr>
|
556
|
+
</table>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
<div class="method_details ">
|
560
|
+
<h3 class="signature " id="fetch_value-instance_method">
|
561
|
+
|
562
|
+
#<strong>fetch_value</strong>(id, opts = {}) ⇒ <tt>Object</tt>
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
</h3><div class="docstring">
|
569
|
+
<div class="discussion">
|
570
|
+
|
571
|
+
<p>Fetches a value.</p>
|
572
|
+
|
573
|
+
|
574
|
+
</div>
|
575
|
+
</div>
|
576
|
+
<div class="tags">
|
577
|
+
<p class="tag_title">Parameters:</p>
|
578
|
+
<ul class="param">
|
579
|
+
|
580
|
+
<li>
|
581
|
+
|
582
|
+
<span class='name'>id</span>
|
583
|
+
|
584
|
+
|
585
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>Array<Symbol></tt>, <tt>nil</tt>)</span>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
</li>
|
590
|
+
|
591
|
+
<li>
|
592
|
+
|
593
|
+
<span class='name'>opts</span>
|
594
|
+
|
595
|
+
|
596
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
597
|
+
|
598
|
+
|
599
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
600
|
+
|
601
|
+
|
602
|
+
—
|
603
|
+
<div class='inline'>
|
604
|
+
<p>`:index`, `:multi`.</p>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
</li>
|
608
|
+
|
609
|
+
</ul>
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
617
|
+
<ul class="option">
|
618
|
+
|
619
|
+
<li>
|
620
|
+
<span class="name">:index</span>
|
621
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
622
|
+
<span class="default">
|
623
|
+
|
624
|
+
</span>
|
625
|
+
|
626
|
+
— <div class='inline'>
|
627
|
+
<p>The index of a multiple-occurrence level/parameter/article.</p>
|
628
|
+
</div>
|
629
|
+
|
630
|
+
</li>
|
631
|
+
|
632
|
+
<li>
|
633
|
+
<span class="name">:multi</span>
|
634
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
635
|
+
<span class="default">
|
636
|
+
|
637
|
+
</span>
|
638
|
+
|
639
|
+
— <div class='inline'>
|
640
|
+
<p>Whether an array of values shall be returned instead of a single value.</p>
|
641
|
+
</div>
|
642
|
+
|
643
|
+
</li>
|
644
|
+
|
645
|
+
</ul>
|
646
|
+
|
647
|
+
|
648
|
+
<p class="tag_title">Returns:</p>
|
649
|
+
<ul class="return">
|
650
|
+
|
651
|
+
<li>
|
652
|
+
|
653
|
+
|
654
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
</li>
|
659
|
+
|
660
|
+
</ul>
|
661
|
+
<p class="tag_title">Raises:</p>
|
662
|
+
<ul class="raise">
|
663
|
+
|
664
|
+
<li>
|
665
|
+
|
666
|
+
|
667
|
+
<span class='type'>(<tt><span class='object_link'><a href="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">TermUtils::AP::NoSuchValueError</a></span></tt>)</span>
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
</li>
|
672
|
+
|
673
|
+
</ul>
|
674
|
+
|
675
|
+
</div><table class="source_code">
|
676
|
+
<tr>
|
677
|
+
<td>
|
678
|
+
<pre class="lines">
|
679
|
+
|
680
|
+
|
681
|
+
68
|
682
|
+
69
|
683
|
+
70
|
684
|
+
71
|
685
|
+
72
|
686
|
+
73
|
687
|
+
74
|
688
|
+
75
|
689
|
+
76
|
690
|
+
77
|
691
|
+
78
|
692
|
+
79
|
693
|
+
80
|
694
|
+
81
|
695
|
+
82
|
696
|
+
83
|
697
|
+
84
|
698
|
+
85
|
699
|
+
86
|
700
|
+
87
|
701
|
+
88
|
702
|
+
89
|
703
|
+
90
|
704
|
+
91
|
705
|
+
92
|
706
|
+
93
|
707
|
+
94
|
708
|
+
95
|
709
|
+
96
|
710
|
+
97
|
711
|
+
98
|
712
|
+
99
|
713
|
+
100
|
714
|
+
101
|
715
|
+
102
|
716
|
+
103
|
717
|
+
104
|
718
|
+
105
|
719
|
+
106
|
720
|
+
107
|
721
|
+
108
|
722
|
+
109
|
723
|
+
110
|
724
|
+
111
|
725
|
+
112</pre>
|
726
|
+
</td>
|
727
|
+
<td>
|
728
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 68</span>
|
729
|
+
|
730
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fetch_value'>fetch_value</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</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>
|
731
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
732
|
+
<span class='id identifier rubyid_multi'>multi</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:multi</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
733
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_id'>id</span>
|
734
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='ivar'>@value</span>
|
735
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span> <span class='op'>&&</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span> <span class='op'>&&</span> <span class='id identifier rubyid_index'>index</span>
|
736
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_node'>child_node</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
737
|
+
<span class='kw'>end</span>
|
738
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_node'>node</span>
|
739
|
+
<span class='id identifier rubyid_vals'>vals</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_collect_values'>collect_values</span>
|
740
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
741
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_multi'>multi</span> <span class='op'>?</span> <span class='id identifier rubyid_vals'>vals</span> <span class='op'>:</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
742
|
+
<span class='kw'>end</span>
|
743
|
+
<span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
744
|
+
<span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='id identifier rubyid_fetch_syntax_object'>fetch_syntax_object</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
745
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such syntax object</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_obj'>obj</span>
|
746
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
747
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span> <span class='op'>&&</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span> <span class='op'>&&</span> <span class='id identifier rubyid_index'>index</span>
|
748
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_node'>child_node</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
749
|
+
<span class='kw'>end</span>
|
750
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_node'>node</span>
|
751
|
+
<span class='id identifier rubyid_catch'>catch</span> <span class='symbol'>:value</span> <span class='kw'>do</span>
|
752
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="Parameter.html" title="TermUtils::AP::Parameter (class)">Parameter</a></span></span>
|
753
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>parameter has no article</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_articles'>articles</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
754
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_leaf?'>leaf?</span>
|
755
|
+
<span class='id identifier rubyid_vals'>vals</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_collect_values'>collect_values</span>
|
756
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
757
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_multi'>multi</span>
|
758
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span>
|
759
|
+
<span class='kw'>else</span>
|
760
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
761
|
+
<span class='kw'>end</span>
|
762
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="Article.html" title="TermUtils::AP::Article (class)">Article</a></span></span>
|
763
|
+
<span class='comment'># raise TermUtils::AP::NoSuchValueError, "no such value" if node.leaf?
|
764
|
+
</span> <span class='id identifier rubyid_vals'>vals</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_collect_values'>collect_values</span>
|
765
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
766
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_multi'>multi</span>
|
767
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span>
|
768
|
+
<span class='kw'>else</span>
|
769
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</span> <span class='id identifier rubyid_vals'>vals</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
770
|
+
<span class='kw'>end</span>
|
771
|
+
<span class='kw'>end</span>
|
772
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>wrong id</span><span class='tstring_end'>"</span></span>
|
773
|
+
<span class='kw'>end</span>
|
774
|
+
<span class='kw'>end</span></pre>
|
775
|
+
</td>
|
776
|
+
</tr>
|
777
|
+
</table>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
<div class="method_details ">
|
781
|
+
<h3 class="signature " id="present?-instance_method">
|
782
|
+
|
783
|
+
#<strong>present?</strong>(id) ⇒ <tt>Boolean</tt>
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
</h3><div class="docstring">
|
790
|
+
<div class="discussion">
|
791
|
+
|
792
|
+
<p>Tests whether a given level/parameter/article is present in the result value.</p>
|
793
|
+
|
794
|
+
|
795
|
+
</div>
|
796
|
+
</div>
|
797
|
+
<div class="tags">
|
798
|
+
<p class="tag_title">Parameters:</p>
|
799
|
+
<ul class="param">
|
800
|
+
|
801
|
+
<li>
|
802
|
+
|
803
|
+
<span class='name'>id</span>
|
804
|
+
|
805
|
+
|
806
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>Array<Symbol></tt>)</span>
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
</li>
|
811
|
+
|
812
|
+
</ul>
|
813
|
+
|
814
|
+
<p class="tag_title">Returns:</p>
|
815
|
+
<ul class="return">
|
816
|
+
|
817
|
+
<li>
|
818
|
+
|
819
|
+
|
820
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
</li>
|
825
|
+
|
826
|
+
</ul>
|
827
|
+
|
828
|
+
</div><table class="source_code">
|
829
|
+
<tr>
|
830
|
+
<td>
|
831
|
+
<pre class="lines">
|
832
|
+
|
833
|
+
|
834
|
+
41
|
835
|
+
42
|
836
|
+
43
|
837
|
+
44
|
838
|
+
45
|
839
|
+
46
|
840
|
+
47</pre>
|
841
|
+
</td>
|
842
|
+
<td>
|
843
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 41</span>
|
844
|
+
|
845
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_present?'>present?</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
846
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
847
|
+
<span class='op'>!</span><span class='op'>!</span><span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_child_node'>child_node</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
848
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
849
|
+
<span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_node_exists?'>node_exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
850
|
+
<span class='kw'>end</span>
|
851
|
+
<span class='kw'>end</span></pre>
|
852
|
+
</td>
|
853
|
+
</tr>
|
854
|
+
</table>
|
855
|
+
</div>
|
856
|
+
|
857
|
+
<div class="method_details ">
|
858
|
+
<h3 class="signature " id="shift-instance_method">
|
859
|
+
|
860
|
+
#<strong>shift</strong>(id, opts = {}) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>
|
861
|
+
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
|
866
|
+
</h3><div class="docstring">
|
867
|
+
<div class="discussion">
|
868
|
+
|
869
|
+
<p>Shifts this one.</p>
|
870
|
+
|
871
|
+
|
872
|
+
</div>
|
873
|
+
</div>
|
874
|
+
<div class="tags">
|
875
|
+
<p class="tag_title">Parameters:</p>
|
876
|
+
<ul class="param">
|
877
|
+
|
878
|
+
<li>
|
879
|
+
|
880
|
+
<span class='name'>id</span>
|
881
|
+
|
882
|
+
|
883
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>Array<Symbol></tt>)</span>
|
884
|
+
|
885
|
+
|
886
|
+
|
887
|
+
</li>
|
888
|
+
|
889
|
+
<li>
|
890
|
+
|
891
|
+
<span class='name'>opts</span>
|
892
|
+
|
893
|
+
|
894
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
895
|
+
|
896
|
+
|
897
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
898
|
+
|
899
|
+
|
900
|
+
—
|
901
|
+
<div class='inline'>
|
902
|
+
<p>`:index`, `:multi`.</p>
|
903
|
+
</div>
|
904
|
+
|
905
|
+
</li>
|
906
|
+
|
907
|
+
</ul>
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
|
913
|
+
|
914
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
915
|
+
<ul class="option">
|
916
|
+
|
917
|
+
<li>
|
918
|
+
<span class="name">:index</span>
|
919
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
920
|
+
<span class="default">
|
921
|
+
|
922
|
+
</span>
|
923
|
+
|
924
|
+
— <div class='inline'>
|
925
|
+
<p>The index of a multiple-occurrence level/parameter/article.</p>
|
926
|
+
</div>
|
927
|
+
|
928
|
+
</li>
|
929
|
+
|
930
|
+
</ul>
|
931
|
+
|
932
|
+
|
933
|
+
<p class="tag_title">Returns:</p>
|
934
|
+
<ul class="return">
|
935
|
+
|
936
|
+
<li>
|
937
|
+
|
938
|
+
|
939
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="TermUtils::AP::Result (class)">TermUtils::AP::Result</a></span></tt>)</span>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
</li>
|
944
|
+
|
945
|
+
</ul>
|
946
|
+
<p class="tag_title">Raises:</p>
|
947
|
+
<ul class="raise">
|
948
|
+
|
949
|
+
<li>
|
950
|
+
|
951
|
+
|
952
|
+
<span class='type'>(<tt><span class='object_link'><a href="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">TermUtils::AP::NoSuchValueError</a></span></tt>)</span>
|
953
|
+
|
954
|
+
|
955
|
+
|
956
|
+
</li>
|
957
|
+
|
958
|
+
</ul>
|
959
|
+
|
960
|
+
</div><table class="source_code">
|
961
|
+
<tr>
|
962
|
+
<td>
|
963
|
+
<pre class="lines">
|
964
|
+
|
965
|
+
|
966
|
+
119
|
967
|
+
120
|
968
|
+
121
|
969
|
+
122
|
970
|
+
123
|
971
|
+
124
|
972
|
+
125
|
973
|
+
126
|
974
|
+
127
|
975
|
+
128
|
976
|
+
129
|
977
|
+
130
|
978
|
+
131
|
979
|
+
132
|
980
|
+
133
|
981
|
+
134
|
982
|
+
135
|
983
|
+
136
|
984
|
+
137
|
985
|
+
138
|
986
|
+
139</pre>
|
987
|
+
</td>
|
988
|
+
<td>
|
989
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/ap/result.rb', line 119</span>
|
990
|
+
|
991
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</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>
|
992
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
993
|
+
<span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
994
|
+
<span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='id identifier rubyid_fetch_syntax_object'>fetch_syntax_object</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
995
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such syntax object</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_obj'>obj</span>
|
996
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
997
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span> <span class='op'>&&</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span> <span class='op'>&&</span> <span class='id identifier rubyid_index'>index</span>
|
998
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_child_node'>child_node</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
999
|
+
<span class='kw'>end</span>
|
1000
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>no such value</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_node'>node</span>
|
1001
|
+
<span class='id identifier rubyid_catch'>catch</span> <span class='symbol'>:value</span> <span class='kw'>do</span>
|
1002
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="Level.html" title="TermUtils::AP::Level (class)">Level</a></span></span>
|
1003
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</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="" 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="#initialize-instance_method" title="TermUtils::AP::Result#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_syntax'>syntax</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
1004
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="Parameter.html" title="TermUtils::AP::Parameter (class)">Parameter</a></span></span>
|
1005
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</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="" 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="#initialize-instance_method" title="TermUtils::AP::Result#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
1006
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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="Article.html" title="TermUtils::AP::Article (class)">Article</a></span></span>
|
1007
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:value</span><span class='comma'>,</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="" 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="#initialize-instance_method" title="TermUtils::AP::Result#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@syntax</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
1008
|
+
<span class='kw'>end</span>
|
1009
|
+
<span class='id identifier rubyid_raise'>raise</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="NoSuchValueError.html" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>wrong id</span><span class='tstring_end'>"</span></span>
|
1010
|
+
<span class='kw'>end</span>
|
1011
|
+
<span class='kw'>end</span></pre>
|
1012
|
+
</td>
|
1013
|
+
</tr>
|
1014
|
+
</table>
|
1015
|
+
</div>
|
1016
|
+
|
1017
|
+
</div>
|
1018
|
+
|
1019
|
+
</div>
|
1020
|
+
|
1021
|
+
<div id="footer">
|
1022
|
+
Generated on Sun Nov 10 18:36:19 2019 by
|
1023
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1024
|
+
0.9.20 (ruby-2.6.5).
|
1025
|
+
</div>
|
1026
|
+
|
1027
|
+
</div>
|
1028
|
+
</body>
|
1029
|
+
</html>
|