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,1999 @@
|
|
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::PropertyTreeNode
|
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::PropertyTreeNode";
|
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 (P)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">PropertyTreeNode</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::PropertyTreeNode
|
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::PropertyTreeNode</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/property_tree_node.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Represents a general-purpose tree node that holds a key-value pair.</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="#child_nodes-instance_method" title="#child_nodes (instance method)">#<strong>child_nodes</strong> ⇒ Array<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
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> ⇒ Object </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
166
|
+
|
167
|
+
</li>
|
168
|
+
|
169
|
+
|
170
|
+
<li class="public ">
|
171
|
+
<span class="summary_signature">
|
172
|
+
|
173
|
+
<a href="#parent_node-instance_method" title="#parent_node (instance method)">#<strong>parent_node</strong> ⇒ TermUtils::PropertyTreeNode </a>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</span>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#value-instance_method" title="#value (instance method)">#<strong>value</strong> ⇒ Object </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
</ul>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<h2>
|
227
|
+
Instance Method Summary
|
228
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
229
|
+
</h2>
|
230
|
+
|
231
|
+
<ul class="summary">
|
232
|
+
|
233
|
+
<li class="public ">
|
234
|
+
<span class="summary_signature">
|
235
|
+
|
236
|
+
<a href="#child_node-instance_method" title="#child_node (instance method)">#<strong>child_node</strong>(key) ⇒ TermUtils::PropertyTreeNode<sup>?</sup> </a>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</span>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<span class="summary_desc"><div class='inline'>
|
251
|
+
<p>Returns the child node identified by a given key.</p>
|
252
|
+
</div></span>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
|
257
|
+
<li class="public ">
|
258
|
+
<span class="summary_signature">
|
259
|
+
|
260
|
+
<a href="#collect_nodes-instance_method" title="#collect_nodes (instance method)">#<strong>collect_nodes</strong>(opts = {}) ⇒ Array<TermUtils::PropertyTreeNode> </a>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</span>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<span class="summary_desc"><div class='inline'>
|
275
|
+
<p>Collects nodes.</p>
|
276
|
+
</div></span>
|
277
|
+
|
278
|
+
</li>
|
279
|
+
|
280
|
+
|
281
|
+
<li class="public ">
|
282
|
+
<span class="summary_signature">
|
283
|
+
|
284
|
+
<a href="#collect_paths-instance_method" title="#collect_paths (instance method)">#<strong>collect_paths</strong>(opts = {}) ⇒ Array<Array<Object>> </a>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
</span>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
<span class="summary_desc"><div class='inline'>
|
299
|
+
<p>Collects node paths.</p>
|
300
|
+
</div></span>
|
301
|
+
|
302
|
+
</li>
|
303
|
+
|
304
|
+
|
305
|
+
<li class="public ">
|
306
|
+
<span class="summary_signature">
|
307
|
+
|
308
|
+
<a href="#collect_values-instance_method" title="#collect_values (instance method)">#<strong>collect_values</strong>(opts = {}) ⇒ Array<Object> </a>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<span class="summary_desc"><div class='inline'>
|
323
|
+
<p>Collect node values.</p>
|
324
|
+
</div></span>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
|
329
|
+
<li class="public ">
|
330
|
+
<span class="summary_signature">
|
331
|
+
|
332
|
+
<a href="#define_node-instance_method" title="#define_node (instance method)">#<strong>define_node</strong>(opts = {}, &block) ⇒ TermUtils::PropertyTreeNode </a>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<span class="summary_desc"><div class='inline'>
|
347
|
+
<p>Creates a new node and adds it as a child.</p>
|
348
|
+
</div></span>
|
349
|
+
|
350
|
+
</li>
|
351
|
+
|
352
|
+
|
353
|
+
<li class="public ">
|
354
|
+
<span class="summary_signature">
|
355
|
+
|
356
|
+
<a href="#each_node-instance_method" title="#each_node (instance method)">#<strong>each_node</strong>(opts = {}, &block) ⇒ nil </a>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</span>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
<span class="summary_desc"><div class='inline'>
|
371
|
+
<p>Iterates over every node.</p>
|
372
|
+
</div></span>
|
373
|
+
|
374
|
+
</li>
|
375
|
+
|
376
|
+
|
377
|
+
<li class="public ">
|
378
|
+
<span class="summary_signature">
|
379
|
+
|
380
|
+
<a href="#eval_child_count-instance_method" title="#eval_child_count (instance method)">#<strong>eval_child_count</strong>(path) ⇒ Integer </a>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
</span>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
<span class="summary_desc"><div class='inline'>
|
395
|
+
<p>Evaluates the total number of nodes in the tree represented by this one.</p>
|
396
|
+
</div></span>
|
397
|
+
|
398
|
+
</li>
|
399
|
+
|
400
|
+
|
401
|
+
<li class="public ">
|
402
|
+
<span class="summary_signature">
|
403
|
+
|
404
|
+
<a href="#find_node-instance_method" title="#find_node (instance method)">#<strong>find_node</strong>(path) ⇒ TermUtils::PropertyTreeNode </a>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</span>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
<span class="summary_desc"><div class='inline'>
|
419
|
+
<p>Finds the node identified by a given path of keys.</p>
|
420
|
+
</div></span>
|
421
|
+
|
422
|
+
</li>
|
423
|
+
|
424
|
+
|
425
|
+
<li class="public ">
|
426
|
+
<span class="summary_signature">
|
427
|
+
|
428
|
+
<a href="#find_node_value-instance_method" title="#find_node_value (instance method)">#<strong>find_node_value</strong>(path) ⇒ Object </a>
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
</span>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
<span class="summary_desc"><div class='inline'>
|
443
|
+
<p>Finds the node identified by a given path of keys and returns its value.</p>
|
444
|
+
</div></span>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
|
449
|
+
<li class="public ">
|
450
|
+
<span class="summary_signature">
|
451
|
+
|
452
|
+
<a href="#head%3F-instance_method" title="#head? (instance method)">#<strong>head?</strong> ⇒ Boolean </a>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
<span class="summary_desc"><div class='inline'>
|
467
|
+
<p>Tests whether this one is the head of the tree (i.e. has no parent).</p>
|
468
|
+
</div></span>
|
469
|
+
|
470
|
+
</li>
|
471
|
+
|
472
|
+
|
473
|
+
<li class="public ">
|
474
|
+
<span class="summary_signature">
|
475
|
+
|
476
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(opts = {}, &block) ⇒ PropertyTreeNode </a>
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
</span>
|
481
|
+
|
482
|
+
|
483
|
+
<span class="note title constructor">constructor</span>
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
<span class="summary_desc"><div class='inline'>
|
493
|
+
<p>Creates a new node.</p>
|
494
|
+
</div></span>
|
495
|
+
|
496
|
+
</li>
|
497
|
+
|
498
|
+
|
499
|
+
<li class="public ">
|
500
|
+
<span class="summary_signature">
|
501
|
+
|
502
|
+
<a href="#initialize_dup-instance_method" title="#initialize_dup (instance method)">#<strong>initialize_dup</strong>(other) ⇒ Object </a>
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
</span>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
<span class="summary_desc"><div class='inline'>
|
517
|
+
<p>For dup method.</p>
|
518
|
+
</div></span>
|
519
|
+
|
520
|
+
</li>
|
521
|
+
|
522
|
+
|
523
|
+
<li class="public ">
|
524
|
+
<span class="summary_signature">
|
525
|
+
|
526
|
+
<a href="#leaf%3F-instance_method" title="#leaf? (instance method)">#<strong>leaf?</strong> ⇒ Boolean </a>
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
</span>
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
<span class="summary_desc"><div class='inline'>
|
541
|
+
<p>Tests whether this one is a leaf of the tree (i.e. has no child).</p>
|
542
|
+
</div></span>
|
543
|
+
|
544
|
+
</li>
|
545
|
+
|
546
|
+
|
547
|
+
<li class="public ">
|
548
|
+
<span class="summary_signature">
|
549
|
+
|
550
|
+
<a href="#node_exists%3F-instance_method" title="#node_exists? (instance method)">#<strong>node_exists?</strong>(path) ⇒ Boolean </a>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
</span>
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
<span class="summary_desc"><div class='inline'>
|
565
|
+
<p>Tests whether the node identified by a given path of keys exists.</p>
|
566
|
+
</div></span>
|
567
|
+
|
568
|
+
</li>
|
569
|
+
|
570
|
+
|
571
|
+
<li class="public ">
|
572
|
+
<span class="summary_signature">
|
573
|
+
|
574
|
+
<a href="#path-instance_method" title="#path (instance method)">#<strong>path</strong> ⇒ Array<Object> </a>
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
</span>
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
<span class="summary_desc"><div class='inline'>
|
589
|
+
<p>Builds the path of keys.</p>
|
590
|
+
</div></span>
|
591
|
+
|
592
|
+
</li>
|
593
|
+
|
594
|
+
|
595
|
+
</ul>
|
596
|
+
|
597
|
+
|
598
|
+
<div id="constructor_details" class="method_details_list">
|
599
|
+
<h2>Constructor Details</h2>
|
600
|
+
|
601
|
+
<div class="method_details first">
|
602
|
+
<h3 class="signature first" id="initialize-instance_method">
|
603
|
+
|
604
|
+
#<strong>initialize</strong>(opts = {}, &block) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">PropertyTreeNode</a></span></tt>
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
</h3><div class="docstring">
|
611
|
+
<div class="discussion">
|
612
|
+
|
613
|
+
<p>Creates a new node. option opts [Object] :key option opts [Object] :value</p>
|
614
|
+
|
615
|
+
|
616
|
+
</div>
|
617
|
+
</div>
|
618
|
+
<div class="tags">
|
619
|
+
<p class="tag_title">Parameters:</p>
|
620
|
+
<ul class="param">
|
621
|
+
|
622
|
+
<li>
|
623
|
+
|
624
|
+
<span class='name'>opts</span>
|
625
|
+
|
626
|
+
|
627
|
+
<span class='type'>(<tt>Hash<Symbol, Object></tt>)</span>
|
628
|
+
|
629
|
+
|
630
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
631
|
+
|
632
|
+
|
633
|
+
</li>
|
634
|
+
|
635
|
+
</ul>
|
636
|
+
|
637
|
+
|
638
|
+
</div><table class="source_code">
|
639
|
+
<tr>
|
640
|
+
<td>
|
641
|
+
<pre class="lines">
|
642
|
+
|
643
|
+
|
644
|
+
31
|
645
|
+
32
|
646
|
+
33
|
647
|
+
34
|
648
|
+
35
|
649
|
+
36
|
650
|
+
37</pre>
|
651
|
+
</td>
|
652
|
+
<td>
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 31</span>
|
654
|
+
|
655
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</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>
|
656
|
+
<span class='ivar'>@parent_node</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
657
|
+
<span class='ivar'>@child_nodes</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
658
|
+
<span class='ivar'>@key</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'>:key</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
659
|
+
<span class='ivar'>@value</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'>:value</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
660
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
661
|
+
<span class='kw'>end</span></pre>
|
662
|
+
</td>
|
663
|
+
</tr>
|
664
|
+
</table>
|
665
|
+
</div>
|
666
|
+
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div id="instance_attr_details" class="attr_details">
|
670
|
+
<h2>Instance Attribute Details</h2>
|
671
|
+
|
672
|
+
|
673
|
+
<span id="child_nodes=-instance_method"></span>
|
674
|
+
<div class="method_details first">
|
675
|
+
<h3 class="signature first" id="child_nodes-instance_method">
|
676
|
+
|
677
|
+
#<strong>child_nodes</strong> ⇒ <tt>Array<<span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span>></tt>
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
</h3><div class="docstring">
|
684
|
+
<div class="discussion">
|
685
|
+
|
686
|
+
|
687
|
+
</div>
|
688
|
+
</div>
|
689
|
+
<div class="tags">
|
690
|
+
|
691
|
+
<p class="tag_title">Returns:</p>
|
692
|
+
<ul class="return">
|
693
|
+
|
694
|
+
<li>
|
695
|
+
|
696
|
+
|
697
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span>></tt>)</span>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
</li>
|
702
|
+
|
703
|
+
</ul>
|
704
|
+
|
705
|
+
</div><table class="source_code">
|
706
|
+
<tr>
|
707
|
+
<td>
|
708
|
+
<pre class="lines">
|
709
|
+
|
710
|
+
|
711
|
+
22
|
712
|
+
23
|
713
|
+
24</pre>
|
714
|
+
</td>
|
715
|
+
<td>
|
716
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 22</span>
|
717
|
+
|
718
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_child_nodes'>child_nodes</span>
|
719
|
+
<span class='ivar'>@child_nodes</span>
|
720
|
+
<span class='kw'>end</span></pre>
|
721
|
+
</td>
|
722
|
+
</tr>
|
723
|
+
</table>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
|
727
|
+
<span id="key=-instance_method"></span>
|
728
|
+
<div class="method_details ">
|
729
|
+
<h3 class="signature " id="key-instance_method">
|
730
|
+
|
731
|
+
#<strong>key</strong> ⇒ <tt>Object</tt>
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
</h3><div class="docstring">
|
738
|
+
<div class="discussion">
|
739
|
+
|
740
|
+
|
741
|
+
</div>
|
742
|
+
</div>
|
743
|
+
<div class="tags">
|
744
|
+
|
745
|
+
<p class="tag_title">Returns:</p>
|
746
|
+
<ul class="return">
|
747
|
+
|
748
|
+
<li>
|
749
|
+
|
750
|
+
|
751
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
</li>
|
756
|
+
|
757
|
+
</ul>
|
758
|
+
|
759
|
+
</div><table class="source_code">
|
760
|
+
<tr>
|
761
|
+
<td>
|
762
|
+
<pre class="lines">
|
763
|
+
|
764
|
+
|
765
|
+
24
|
766
|
+
25
|
767
|
+
26</pre>
|
768
|
+
</td>
|
769
|
+
<td>
|
770
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 24</span>
|
771
|
+
|
772
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
|
773
|
+
<span class='ivar'>@key</span>
|
774
|
+
<span class='kw'>end</span></pre>
|
775
|
+
</td>
|
776
|
+
</tr>
|
777
|
+
</table>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
|
781
|
+
<span id="parent_node=-instance_method"></span>
|
782
|
+
<div class="method_details ">
|
783
|
+
<h3 class="signature " id="parent_node-instance_method">
|
784
|
+
|
785
|
+
#<strong>parent_node</strong> ⇒ <tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
|
791
|
+
</h3><div class="docstring">
|
792
|
+
<div class="discussion">
|
793
|
+
|
794
|
+
|
795
|
+
</div>
|
796
|
+
</div>
|
797
|
+
<div class="tags">
|
798
|
+
|
799
|
+
<p class="tag_title">Returns:</p>
|
800
|
+
<ul class="return">
|
801
|
+
|
802
|
+
<li>
|
803
|
+
|
804
|
+
|
805
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>)</span>
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
</li>
|
810
|
+
|
811
|
+
</ul>
|
812
|
+
|
813
|
+
</div><table class="source_code">
|
814
|
+
<tr>
|
815
|
+
<td>
|
816
|
+
<pre class="lines">
|
817
|
+
|
818
|
+
|
819
|
+
20
|
820
|
+
21
|
821
|
+
22</pre>
|
822
|
+
</td>
|
823
|
+
<td>
|
824
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 20</span>
|
825
|
+
|
826
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parent_node'>parent_node</span>
|
827
|
+
<span class='ivar'>@parent_node</span>
|
828
|
+
<span class='kw'>end</span></pre>
|
829
|
+
</td>
|
830
|
+
</tr>
|
831
|
+
</table>
|
832
|
+
</div>
|
833
|
+
|
834
|
+
|
835
|
+
<span id="value=-instance_method"></span>
|
836
|
+
<div class="method_details ">
|
837
|
+
<h3 class="signature " id="value-instance_method">
|
838
|
+
|
839
|
+
#<strong>value</strong> ⇒ <tt>Object</tt>
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
|
844
|
+
|
845
|
+
</h3><div class="docstring">
|
846
|
+
<div class="discussion">
|
847
|
+
|
848
|
+
|
849
|
+
</div>
|
850
|
+
</div>
|
851
|
+
<div class="tags">
|
852
|
+
|
853
|
+
<p class="tag_title">Returns:</p>
|
854
|
+
<ul class="return">
|
855
|
+
|
856
|
+
<li>
|
857
|
+
|
858
|
+
|
859
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
</li>
|
864
|
+
|
865
|
+
</ul>
|
866
|
+
|
867
|
+
</div><table class="source_code">
|
868
|
+
<tr>
|
869
|
+
<td>
|
870
|
+
<pre class="lines">
|
871
|
+
|
872
|
+
|
873
|
+
26
|
874
|
+
27
|
875
|
+
28</pre>
|
876
|
+
</td>
|
877
|
+
<td>
|
878
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 26</span>
|
879
|
+
|
880
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
881
|
+
<span class='ivar'>@value</span>
|
882
|
+
<span class='kw'>end</span></pre>
|
883
|
+
</td>
|
884
|
+
</tr>
|
885
|
+
</table>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
</div>
|
889
|
+
|
890
|
+
|
891
|
+
<div id="instance_method_details" class="method_details_list">
|
892
|
+
<h2>Instance Method Details</h2>
|
893
|
+
|
894
|
+
|
895
|
+
<div class="method_details first">
|
896
|
+
<h3 class="signature first" id="child_node-instance_method">
|
897
|
+
|
898
|
+
#<strong>child_node</strong>(key) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt><sup>?</sup>
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
</h3><div class="docstring">
|
905
|
+
<div class="discussion">
|
906
|
+
|
907
|
+
<p>Returns the child node identified by a given key.</p>
|
908
|
+
|
909
|
+
|
910
|
+
</div>
|
911
|
+
</div>
|
912
|
+
<div class="tags">
|
913
|
+
<p class="tag_title">Parameters:</p>
|
914
|
+
<ul class="param">
|
915
|
+
|
916
|
+
<li>
|
917
|
+
|
918
|
+
<span class='name'>key</span>
|
919
|
+
|
920
|
+
|
921
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
922
|
+
|
923
|
+
|
924
|
+
|
925
|
+
</li>
|
926
|
+
|
927
|
+
</ul>
|
928
|
+
|
929
|
+
<p class="tag_title">Returns:</p>
|
930
|
+
<ul class="return">
|
931
|
+
|
932
|
+
<li>
|
933
|
+
|
934
|
+
|
935
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>, <tt>nil</tt>)</span>
|
936
|
+
|
937
|
+
|
938
|
+
|
939
|
+
</li>
|
940
|
+
|
941
|
+
</ul>
|
942
|
+
|
943
|
+
</div><table class="source_code">
|
944
|
+
<tr>
|
945
|
+
<td>
|
946
|
+
<pre class="lines">
|
947
|
+
|
948
|
+
|
949
|
+
64
|
950
|
+
65
|
951
|
+
66
|
952
|
+
67
|
953
|
+
68</pre>
|
954
|
+
</td>
|
955
|
+
<td>
|
956
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 64</span>
|
957
|
+
|
958
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_child_node'>child_node</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
959
|
+
<span class='kw'>if</span> <span class='ivar'>@child_nodes</span>
|
960
|
+
<span class='ivar'>@child_nodes</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>==</span> <span class='id identifier rubyid_key'>key</span> <span class='rbrace'>}</span>
|
961
|
+
<span class='kw'>end</span>
|
962
|
+
<span class='kw'>end</span></pre>
|
963
|
+
</td>
|
964
|
+
</tr>
|
965
|
+
</table>
|
966
|
+
</div>
|
967
|
+
|
968
|
+
<div class="method_details ">
|
969
|
+
<h3 class="signature " id="collect_nodes-instance_method">
|
970
|
+
|
971
|
+
#<strong>collect_nodes</strong>(opts = {}) ⇒ <tt>Array<<span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span>></tt>
|
972
|
+
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
</h3><div class="docstring">
|
978
|
+
<div class="discussion">
|
979
|
+
|
980
|
+
<p>Collects nodes.</p>
|
981
|
+
|
982
|
+
|
983
|
+
</div>
|
984
|
+
</div>
|
985
|
+
<div class="tags">
|
986
|
+
<p class="tag_title">Parameters:</p>
|
987
|
+
<ul class="param">
|
988
|
+
|
989
|
+
<li>
|
990
|
+
|
991
|
+
<span class='name'>opts</span>
|
992
|
+
|
993
|
+
|
994
|
+
<span class='type'>(<tt>Hash<Symbol,Object></tt>)</span>
|
995
|
+
|
996
|
+
|
997
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
998
|
+
|
999
|
+
|
1000
|
+
—
|
1001
|
+
<div class='inline'>
|
1002
|
+
<p>`:path`, `:leaf_only`</p>
|
1003
|
+
</div>
|
1004
|
+
|
1005
|
+
</li>
|
1006
|
+
|
1007
|
+
</ul>
|
1008
|
+
|
1009
|
+
<p class="tag_title">Returns:</p>
|
1010
|
+
<ul class="return">
|
1011
|
+
|
1012
|
+
<li>
|
1013
|
+
|
1014
|
+
|
1015
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span>></tt>)</span>
|
1016
|
+
|
1017
|
+
|
1018
|
+
|
1019
|
+
</li>
|
1020
|
+
|
1021
|
+
</ul>
|
1022
|
+
|
1023
|
+
</div><table class="source_code">
|
1024
|
+
<tr>
|
1025
|
+
<td>
|
1026
|
+
<pre class="lines">
|
1027
|
+
|
1028
|
+
|
1029
|
+
137
|
1030
|
+
138
|
1031
|
+
139
|
1032
|
+
140
|
1033
|
+
141
|
1034
|
+
142
|
1035
|
+
143</pre>
|
1036
|
+
</td>
|
1037
|
+
<td>
|
1038
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 137</span>
|
1039
|
+
|
1040
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collect_nodes'>collect_nodes</span><span class='lparen'>(</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>
|
1041
|
+
<span class='id identifier rubyid_nodes'>nodes</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1042
|
+
<span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1043
|
+
<span class='id identifier rubyid_nodes'>nodes</span> <span class='op'><<</span> <span class='id identifier rubyid_n'>n</span>
|
1044
|
+
<span class='kw'>end</span>
|
1045
|
+
<span class='id identifier rubyid_nodes'>nodes</span>
|
1046
|
+
<span class='kw'>end</span></pre>
|
1047
|
+
</td>
|
1048
|
+
</tr>
|
1049
|
+
</table>
|
1050
|
+
</div>
|
1051
|
+
|
1052
|
+
<div class="method_details ">
|
1053
|
+
<h3 class="signature " id="collect_paths-instance_method">
|
1054
|
+
|
1055
|
+
#<strong>collect_paths</strong>(opts = {}) ⇒ <tt>Array<Array<Object>></tt>
|
1056
|
+
|
1057
|
+
|
1058
|
+
|
1059
|
+
|
1060
|
+
|
1061
|
+
</h3><div class="docstring">
|
1062
|
+
<div class="discussion">
|
1063
|
+
|
1064
|
+
<p>Collects node paths.</p>
|
1065
|
+
|
1066
|
+
|
1067
|
+
</div>
|
1068
|
+
</div>
|
1069
|
+
<div class="tags">
|
1070
|
+
<p class="tag_title">Parameters:</p>
|
1071
|
+
<ul class="param">
|
1072
|
+
|
1073
|
+
<li>
|
1074
|
+
|
1075
|
+
<span class='name'>opts</span>
|
1076
|
+
|
1077
|
+
|
1078
|
+
<span class='type'>(<tt>Hash<Symbol,Object></tt>)</span>
|
1079
|
+
|
1080
|
+
|
1081
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1082
|
+
|
1083
|
+
|
1084
|
+
—
|
1085
|
+
<div class='inline'>
|
1086
|
+
<p>`:path`, `:leaf_only`</p>
|
1087
|
+
</div>
|
1088
|
+
|
1089
|
+
</li>
|
1090
|
+
|
1091
|
+
</ul>
|
1092
|
+
|
1093
|
+
<p class="tag_title">Returns:</p>
|
1094
|
+
<ul class="return">
|
1095
|
+
|
1096
|
+
<li>
|
1097
|
+
|
1098
|
+
|
1099
|
+
<span class='type'>(<tt>Array<Array<Object>></tt>)</span>
|
1100
|
+
|
1101
|
+
|
1102
|
+
|
1103
|
+
</li>
|
1104
|
+
|
1105
|
+
</ul>
|
1106
|
+
|
1107
|
+
</div><table class="source_code">
|
1108
|
+
<tr>
|
1109
|
+
<td>
|
1110
|
+
<pre class="lines">
|
1111
|
+
|
1112
|
+
|
1113
|
+
147
|
1114
|
+
148
|
1115
|
+
149
|
1116
|
+
150
|
1117
|
+
151
|
1118
|
+
152
|
1119
|
+
153</pre>
|
1120
|
+
</td>
|
1121
|
+
<td>
|
1122
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 147</span>
|
1123
|
+
|
1124
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collect_paths'>collect_paths</span><span class='lparen'>(</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>
|
1125
|
+
<span class='id identifier rubyid_paths'>paths</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1126
|
+
<span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1127
|
+
<span class='id identifier rubyid_paths'>paths</span> <span class='op'><<</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
|
1128
|
+
<span class='kw'>end</span>
|
1129
|
+
<span class='id identifier rubyid_paths'>paths</span>
|
1130
|
+
<span class='kw'>end</span></pre>
|
1131
|
+
</td>
|
1132
|
+
</tr>
|
1133
|
+
</table>
|
1134
|
+
</div>
|
1135
|
+
|
1136
|
+
<div class="method_details ">
|
1137
|
+
<h3 class="signature " id="collect_values-instance_method">
|
1138
|
+
|
1139
|
+
#<strong>collect_values</strong>(opts = {}) ⇒ <tt>Array<Object></tt>
|
1140
|
+
|
1141
|
+
|
1142
|
+
|
1143
|
+
|
1144
|
+
|
1145
|
+
</h3><div class="docstring">
|
1146
|
+
<div class="discussion">
|
1147
|
+
|
1148
|
+
<p>Collect node values.</p>
|
1149
|
+
|
1150
|
+
|
1151
|
+
</div>
|
1152
|
+
</div>
|
1153
|
+
<div class="tags">
|
1154
|
+
<p class="tag_title">Parameters:</p>
|
1155
|
+
<ul class="param">
|
1156
|
+
|
1157
|
+
<li>
|
1158
|
+
|
1159
|
+
<span class='name'>opts</span>
|
1160
|
+
|
1161
|
+
|
1162
|
+
<span class='type'>(<tt>Hash<Symbol,Object></tt>)</span>
|
1163
|
+
|
1164
|
+
|
1165
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1166
|
+
|
1167
|
+
|
1168
|
+
—
|
1169
|
+
<div class='inline'>
|
1170
|
+
<p>`:path`, `:leaf_only`</p>
|
1171
|
+
</div>
|
1172
|
+
|
1173
|
+
</li>
|
1174
|
+
|
1175
|
+
</ul>
|
1176
|
+
|
1177
|
+
<p class="tag_title">Returns:</p>
|
1178
|
+
<ul class="return">
|
1179
|
+
|
1180
|
+
<li>
|
1181
|
+
|
1182
|
+
|
1183
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1184
|
+
|
1185
|
+
|
1186
|
+
|
1187
|
+
</li>
|
1188
|
+
|
1189
|
+
</ul>
|
1190
|
+
|
1191
|
+
</div><table class="source_code">
|
1192
|
+
<tr>
|
1193
|
+
<td>
|
1194
|
+
<pre class="lines">
|
1195
|
+
|
1196
|
+
|
1197
|
+
157
|
1198
|
+
158
|
1199
|
+
159
|
1200
|
+
160
|
1201
|
+
161
|
1202
|
+
162
|
1203
|
+
163</pre>
|
1204
|
+
</td>
|
1205
|
+
<td>
|
1206
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 157</span>
|
1207
|
+
|
1208
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collect_values'>collect_values</span><span class='lparen'>(</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>
|
1209
|
+
<span class='id identifier rubyid_vals'>vals</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1210
|
+
<span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1211
|
+
<span class='id identifier rubyid_vals'>vals</span> <span class='op'><<</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
1212
|
+
<span class='kw'>end</span>
|
1213
|
+
<span class='id identifier rubyid_vals'>vals</span>
|
1214
|
+
<span class='kw'>end</span></pre>
|
1215
|
+
</td>
|
1216
|
+
</tr>
|
1217
|
+
</table>
|
1218
|
+
</div>
|
1219
|
+
|
1220
|
+
<div class="method_details ">
|
1221
|
+
<h3 class="signature " id="define_node-instance_method">
|
1222
|
+
|
1223
|
+
#<strong>define_node</strong>(opts = {}, &block) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>
|
1224
|
+
|
1225
|
+
|
1226
|
+
|
1227
|
+
|
1228
|
+
|
1229
|
+
</h3><div class="docstring">
|
1230
|
+
<div class="discussion">
|
1231
|
+
|
1232
|
+
<p>Creates a new node and adds it as a child.</p>
|
1233
|
+
|
1234
|
+
|
1235
|
+
</div>
|
1236
|
+
</div>
|
1237
|
+
<div class="tags">
|
1238
|
+
<p class="tag_title">Parameters:</p>
|
1239
|
+
<ul class="param">
|
1240
|
+
|
1241
|
+
<li>
|
1242
|
+
|
1243
|
+
<span class='name'>opts</span>
|
1244
|
+
|
1245
|
+
|
1246
|
+
<span class='type'>(<tt>Hash<Symbol,Object></tt>)</span>
|
1247
|
+
|
1248
|
+
|
1249
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1250
|
+
|
1251
|
+
|
1252
|
+
—
|
1253
|
+
<div class='inline'>
|
1254
|
+
<p>key value</p>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
</li>
|
1258
|
+
|
1259
|
+
</ul>
|
1260
|
+
|
1261
|
+
<p class="tag_title">Returns:</p>
|
1262
|
+
<ul class="return">
|
1263
|
+
|
1264
|
+
<li>
|
1265
|
+
|
1266
|
+
|
1267
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>)</span>
|
1268
|
+
|
1269
|
+
|
1270
|
+
|
1271
|
+
</li>
|
1272
|
+
|
1273
|
+
</ul>
|
1274
|
+
|
1275
|
+
</div><table class="source_code">
|
1276
|
+
<tr>
|
1277
|
+
<td>
|
1278
|
+
<pre class="lines">
|
1279
|
+
|
1280
|
+
|
1281
|
+
72
|
1282
|
+
73
|
1283
|
+
74
|
1284
|
+
75
|
1285
|
+
76
|
1286
|
+
77
|
1287
|
+
78
|
1288
|
+
79</pre>
|
1289
|
+
</td>
|
1290
|
+
<td>
|
1291
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 72</span>
|
1292
|
+
|
1293
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_define_node'>define_node</span><span class='lparen'>(</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>
|
1294
|
+
<span class='id identifier rubyid_new_node'>new_node</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="" title="TermUtils::PropertyTreeNode (class)">PropertyTreeNode</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="TermUtils::PropertyTreeNode#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
1295
|
+
<span class='id identifier rubyid_new_node'>new_node</span><span class='period'>.</span><span class='id identifier rubyid_parent_node'>parent_node</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1296
|
+
<span class='ivar'>@child_nodes</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='ivar'>@child_nodes</span>
|
1297
|
+
<span class='ivar'>@child_nodes</span> <span class='op'><<</span> <span class='id identifier rubyid_new_node'>new_node</span>
|
1298
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_new_node'>new_node</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
1299
|
+
<span class='id identifier rubyid_new_node'>new_node</span>
|
1300
|
+
<span class='kw'>end</span></pre>
|
1301
|
+
</td>
|
1302
|
+
</tr>
|
1303
|
+
</table>
|
1304
|
+
</div>
|
1305
|
+
|
1306
|
+
<div class="method_details ">
|
1307
|
+
<h3 class="signature " id="each_node-instance_method">
|
1308
|
+
|
1309
|
+
#<strong>each_node</strong>(opts = {}, &block) ⇒ <tt>nil</tt>
|
1310
|
+
|
1311
|
+
|
1312
|
+
|
1313
|
+
|
1314
|
+
|
1315
|
+
</h3><div class="docstring">
|
1316
|
+
<div class="discussion">
|
1317
|
+
|
1318
|
+
<p>Iterates over every node.</p>
|
1319
|
+
|
1320
|
+
|
1321
|
+
</div>
|
1322
|
+
</div>
|
1323
|
+
<div class="tags">
|
1324
|
+
<p class="tag_title">Parameters:</p>
|
1325
|
+
<ul class="param">
|
1326
|
+
|
1327
|
+
<li>
|
1328
|
+
|
1329
|
+
<span class='name'>opts</span>
|
1330
|
+
|
1331
|
+
|
1332
|
+
<span class='type'>(<tt>Hash<Symbol,Object></tt>)</span>
|
1333
|
+
|
1334
|
+
|
1335
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1336
|
+
|
1337
|
+
|
1338
|
+
—
|
1339
|
+
<div class='inline'>
|
1340
|
+
<p>`:path`, `:leaf_only`</p>
|
1341
|
+
</div>
|
1342
|
+
|
1343
|
+
</li>
|
1344
|
+
|
1345
|
+
</ul>
|
1346
|
+
|
1347
|
+
<p class="tag_title">Returns:</p>
|
1348
|
+
<ul class="return">
|
1349
|
+
|
1350
|
+
<li>
|
1351
|
+
|
1352
|
+
|
1353
|
+
<span class='type'>(<tt>nil</tt>)</span>
|
1354
|
+
|
1355
|
+
|
1356
|
+
|
1357
|
+
</li>
|
1358
|
+
|
1359
|
+
</ul>
|
1360
|
+
|
1361
|
+
</div><table class="source_code">
|
1362
|
+
<tr>
|
1363
|
+
<td>
|
1364
|
+
<pre class="lines">
|
1365
|
+
|
1366
|
+
|
1367
|
+
90
|
1368
|
+
91
|
1369
|
+
92
|
1370
|
+
93
|
1371
|
+
94
|
1372
|
+
95
|
1373
|
+
96
|
1374
|
+
97
|
1375
|
+
98
|
1376
|
+
99
|
1377
|
+
100
|
1378
|
+
101
|
1379
|
+
102
|
1380
|
+
103
|
1381
|
+
104
|
1382
|
+
105
|
1383
|
+
106
|
1384
|
+
107
|
1385
|
+
108
|
1386
|
+
109
|
1387
|
+
110
|
1388
|
+
111
|
1389
|
+
112
|
1390
|
+
113
|
1391
|
+
114
|
1392
|
+
115
|
1393
|
+
116
|
1394
|
+
117
|
1395
|
+
118
|
1396
|
+
119
|
1397
|
+
120
|
1398
|
+
121
|
1399
|
+
122
|
1400
|
+
123
|
1401
|
+
124
|
1402
|
+
125
|
1403
|
+
126
|
1404
|
+
127
|
1405
|
+
128
|
1406
|
+
129
|
1407
|
+
130
|
1408
|
+
131
|
1409
|
+
132
|
1410
|
+
133</pre>
|
1411
|
+
</td>
|
1412
|
+
<td>
|
1413
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 90</span>
|
1414
|
+
|
1415
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</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>
|
1416
|
+
<span class='id identifier rubyid_rpath'>rpath</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1417
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:path</span>
|
1418
|
+
<span class='id identifier rubyid_rpath'>rpath</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:path</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1419
|
+
<span class='kw'>end</span>
|
1420
|
+
<span class='id identifier rubyid_dive'>dive</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1421
|
+
<span class='kw'>if</span> <span class='ivar'>@key</span>
|
1422
|
+
<span class='id identifier rubyid_hide'>hide</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1423
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_rpath'>rpath</span>
|
1424
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_rpath'>rpath</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span> <span class='op'>==</span> <span class='ivar'>@key</span>
|
1425
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_rpath'>rpath</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1426
|
+
<span class='id identifier rubyid_hide'>hide</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1427
|
+
<span class='kw'>end</span>
|
1428
|
+
<span class='kw'>else</span>
|
1429
|
+
<span class='id identifier rubyid_dive'>dive</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1430
|
+
<span class='id identifier rubyid_hide'>hide</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1431
|
+
<span class='kw'>end</span>
|
1432
|
+
<span class='kw'>end</span>
|
1433
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_hide'>hide</span> <span class='kw'>or</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:leaf_only</span><span class='rbracket'>]</span> <span class='kw'>and</span> <span class='ivar'>@child_nodes</span><span class='rparen'>)</span>
|
1434
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:block</span>
|
1435
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:block</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1436
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_block'>block</span>
|
1437
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1438
|
+
<span class='kw'>end</span>
|
1439
|
+
<span class='kw'>end</span>
|
1440
|
+
<span class='kw'>end</span> <span class='comment'># if @key
|
1441
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_dive'>dive</span> <span class='kw'>and</span> <span class='ivar'>@child_nodes</span>
|
1442
|
+
<span class='id identifier rubyid_ropts'>ropts</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1443
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_rpath'>rpath</span>
|
1444
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_rpath'>rpath</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1445
|
+
<span class='id identifier rubyid_ropts'>ropts</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='symbol'>:path</span>
|
1446
|
+
<span class='kw'>else</span>
|
1447
|
+
<span class='id identifier rubyid_ropts'>ropts</span><span class='lbracket'>[</span><span class='symbol'>:path</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_rpath'>rpath</span>
|
1448
|
+
<span class='kw'>end</span>
|
1449
|
+
<span class='kw'>end</span>
|
1450
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
1451
|
+
<span class='id identifier rubyid_ropts'>ropts</span><span class='lbracket'>[</span><span class='symbol'>:block</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
1452
|
+
<span class='kw'>end</span>
|
1453
|
+
<span class='ivar'>@child_nodes</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_n'>n</span><span class='op'>|</span>
|
1454
|
+
<span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</span><span class='id identifier rubyid_ropts'>ropts</span><span class='rparen'>)</span>
|
1455
|
+
<span class='kw'>end</span>
|
1456
|
+
<span class='kw'>end</span>
|
1457
|
+
<span class='kw'>nil</span>
|
1458
|
+
<span class='kw'>end</span></pre>
|
1459
|
+
</td>
|
1460
|
+
</tr>
|
1461
|
+
</table>
|
1462
|
+
</div>
|
1463
|
+
|
1464
|
+
<div class="method_details ">
|
1465
|
+
<h3 class="signature " id="eval_child_count-instance_method">
|
1466
|
+
|
1467
|
+
#<strong>eval_child_count</strong>(path) ⇒ <tt>Integer</tt>
|
1468
|
+
|
1469
|
+
|
1470
|
+
|
1471
|
+
|
1472
|
+
|
1473
|
+
</h3><div class="docstring">
|
1474
|
+
<div class="discussion">
|
1475
|
+
|
1476
|
+
<p>Evaluates the total number of nodes in the tree represented by this one.</p>
|
1477
|
+
|
1478
|
+
|
1479
|
+
</div>
|
1480
|
+
</div>
|
1481
|
+
<div class="tags">
|
1482
|
+
<p class="tag_title">Parameters:</p>
|
1483
|
+
<ul class="param">
|
1484
|
+
|
1485
|
+
<li>
|
1486
|
+
|
1487
|
+
<span class='name'>path</span>
|
1488
|
+
|
1489
|
+
|
1490
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1491
|
+
|
1492
|
+
|
1493
|
+
|
1494
|
+
</li>
|
1495
|
+
|
1496
|
+
</ul>
|
1497
|
+
|
1498
|
+
<p class="tag_title">Returns:</p>
|
1499
|
+
<ul class="return">
|
1500
|
+
|
1501
|
+
<li>
|
1502
|
+
|
1503
|
+
|
1504
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1505
|
+
|
1506
|
+
|
1507
|
+
|
1508
|
+
</li>
|
1509
|
+
|
1510
|
+
</ul>
|
1511
|
+
|
1512
|
+
</div><table class="source_code">
|
1513
|
+
<tr>
|
1514
|
+
<td>
|
1515
|
+
<pre class="lines">
|
1516
|
+
|
1517
|
+
|
1518
|
+
184
|
1519
|
+
185
|
1520
|
+
186
|
1521
|
+
187
|
1522
|
+
188
|
1523
|
+
189</pre>
|
1524
|
+
</td>
|
1525
|
+
<td>
|
1526
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 184</span>
|
1527
|
+
|
1528
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_eval_child_count'>eval_child_count</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1529
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1530
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span>
|
1531
|
+
<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>
|
1532
|
+
<span class='kw'>end</span>
|
1533
|
+
<span class='kw'>end</span></pre>
|
1534
|
+
</td>
|
1535
|
+
</tr>
|
1536
|
+
</table>
|
1537
|
+
</div>
|
1538
|
+
|
1539
|
+
<div class="method_details ">
|
1540
|
+
<h3 class="signature " id="find_node-instance_method">
|
1541
|
+
|
1542
|
+
#<strong>find_node</strong>(path) ⇒ <tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>
|
1543
|
+
|
1544
|
+
|
1545
|
+
|
1546
|
+
|
1547
|
+
|
1548
|
+
</h3><div class="docstring">
|
1549
|
+
<div class="discussion">
|
1550
|
+
|
1551
|
+
<p>Finds the node identified by a given path of keys.</p>
|
1552
|
+
|
1553
|
+
|
1554
|
+
</div>
|
1555
|
+
</div>
|
1556
|
+
<div class="tags">
|
1557
|
+
<p class="tag_title">Parameters:</p>
|
1558
|
+
<ul class="param">
|
1559
|
+
|
1560
|
+
<li>
|
1561
|
+
|
1562
|
+
<span class='name'>path</span>
|
1563
|
+
|
1564
|
+
|
1565
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1566
|
+
|
1567
|
+
|
1568
|
+
|
1569
|
+
</li>
|
1570
|
+
|
1571
|
+
</ul>
|
1572
|
+
|
1573
|
+
<p class="tag_title">Returns:</p>
|
1574
|
+
<ul class="return">
|
1575
|
+
|
1576
|
+
<li>
|
1577
|
+
|
1578
|
+
|
1579
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="TermUtils::PropertyTreeNode (class)">TermUtils::PropertyTreeNode</a></span></tt>)</span>
|
1580
|
+
|
1581
|
+
|
1582
|
+
|
1583
|
+
</li>
|
1584
|
+
|
1585
|
+
</ul>
|
1586
|
+
|
1587
|
+
</div><table class="source_code">
|
1588
|
+
<tr>
|
1589
|
+
<td>
|
1590
|
+
<pre class="lines">
|
1591
|
+
|
1592
|
+
|
1593
|
+
167
|
1594
|
+
168
|
1595
|
+
169
|
1596
|
+
170
|
1597
|
+
171
|
1598
|
+
172
|
1599
|
+
173
|
1600
|
+
174</pre>
|
1601
|
+
</td>
|
1602
|
+
<td>
|
1603
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 167</span>
|
1604
|
+
|
1605
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1606
|
+
<span class='id identifier rubyid_catch'>catch</span> <span class='symbol'>:found</span> <span class='kw'>do</span>
|
1607
|
+
<span class='id identifier rubyid_each_node'>each_node</span><span class='lparen'>(</span><span class='symbol'>:path</span> <span class='op'>=></span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1608
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:found</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span>
|
1609
|
+
<span class='kw'>end</span>
|
1610
|
+
<span class='kw'>nil</span>
|
1611
|
+
<span class='kw'>end</span>
|
1612
|
+
<span class='kw'>end</span></pre>
|
1613
|
+
</td>
|
1614
|
+
</tr>
|
1615
|
+
</table>
|
1616
|
+
</div>
|
1617
|
+
|
1618
|
+
<div class="method_details ">
|
1619
|
+
<h3 class="signature " id="find_node_value-instance_method">
|
1620
|
+
|
1621
|
+
#<strong>find_node_value</strong>(path) ⇒ <tt>Object</tt>
|
1622
|
+
|
1623
|
+
|
1624
|
+
|
1625
|
+
|
1626
|
+
|
1627
|
+
</h3><div class="docstring">
|
1628
|
+
<div class="discussion">
|
1629
|
+
|
1630
|
+
<p>Finds the node identified by a given path of keys and returns its value.</p>
|
1631
|
+
|
1632
|
+
|
1633
|
+
</div>
|
1634
|
+
</div>
|
1635
|
+
<div class="tags">
|
1636
|
+
<p class="tag_title">Parameters:</p>
|
1637
|
+
<ul class="param">
|
1638
|
+
|
1639
|
+
<li>
|
1640
|
+
|
1641
|
+
<span class='name'>path</span>
|
1642
|
+
|
1643
|
+
|
1644
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1645
|
+
|
1646
|
+
|
1647
|
+
|
1648
|
+
</li>
|
1649
|
+
|
1650
|
+
</ul>
|
1651
|
+
|
1652
|
+
<p class="tag_title">Returns:</p>
|
1653
|
+
<ul class="return">
|
1654
|
+
|
1655
|
+
<li>
|
1656
|
+
|
1657
|
+
|
1658
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1659
|
+
|
1660
|
+
|
1661
|
+
|
1662
|
+
</li>
|
1663
|
+
|
1664
|
+
</ul>
|
1665
|
+
|
1666
|
+
</div><table class="source_code">
|
1667
|
+
<tr>
|
1668
|
+
<td>
|
1669
|
+
<pre class="lines">
|
1670
|
+
|
1671
|
+
|
1672
|
+
193
|
1673
|
+
194
|
1674
|
+
195
|
1675
|
+
196
|
1676
|
+
197
|
1677
|
+
198</pre>
|
1678
|
+
</td>
|
1679
|
+
<td>
|
1680
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 193</span>
|
1681
|
+
|
1682
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_node_value'>find_node_value</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1683
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1684
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span>
|
1685
|
+
<span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
1686
|
+
<span class='kw'>end</span>
|
1687
|
+
<span class='kw'>end</span></pre>
|
1688
|
+
</td>
|
1689
|
+
</tr>
|
1690
|
+
</table>
|
1691
|
+
</div>
|
1692
|
+
|
1693
|
+
<div class="method_details ">
|
1694
|
+
<h3 class="signature " id="head?-instance_method">
|
1695
|
+
|
1696
|
+
#<strong>head?</strong> ⇒ <tt>Boolean</tt>
|
1697
|
+
|
1698
|
+
|
1699
|
+
|
1700
|
+
|
1701
|
+
|
1702
|
+
</h3><div class="docstring">
|
1703
|
+
<div class="discussion">
|
1704
|
+
|
1705
|
+
<p>Tests whether this one is the head of the tree (i.e. has no parent).</p>
|
1706
|
+
|
1707
|
+
|
1708
|
+
</div>
|
1709
|
+
</div>
|
1710
|
+
<div class="tags">
|
1711
|
+
|
1712
|
+
<p class="tag_title">Returns:</p>
|
1713
|
+
<ul class="return">
|
1714
|
+
|
1715
|
+
<li>
|
1716
|
+
|
1717
|
+
|
1718
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1719
|
+
|
1720
|
+
|
1721
|
+
|
1722
|
+
</li>
|
1723
|
+
|
1724
|
+
</ul>
|
1725
|
+
|
1726
|
+
</div><table class="source_code">
|
1727
|
+
<tr>
|
1728
|
+
<td>
|
1729
|
+
<pre class="lines">
|
1730
|
+
|
1731
|
+
|
1732
|
+
53
|
1733
|
+
54
|
1734
|
+
55</pre>
|
1735
|
+
</td>
|
1736
|
+
<td>
|
1737
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 53</span>
|
1738
|
+
|
1739
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_head?'>head?</span>
|
1740
|
+
<span class='ivar'>@parent_node</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1741
|
+
<span class='kw'>end</span></pre>
|
1742
|
+
</td>
|
1743
|
+
</tr>
|
1744
|
+
</table>
|
1745
|
+
</div>
|
1746
|
+
|
1747
|
+
<div class="method_details ">
|
1748
|
+
<h3 class="signature " id="initialize_dup-instance_method">
|
1749
|
+
|
1750
|
+
#<strong>initialize_dup</strong>(other) ⇒ <tt>Object</tt>
|
1751
|
+
|
1752
|
+
|
1753
|
+
|
1754
|
+
|
1755
|
+
|
1756
|
+
</h3><div class="docstring">
|
1757
|
+
<div class="discussion">
|
1758
|
+
|
1759
|
+
<p>For dup method.</p>
|
1760
|
+
|
1761
|
+
|
1762
|
+
</div>
|
1763
|
+
</div>
|
1764
|
+
<div class="tags">
|
1765
|
+
|
1766
|
+
|
1767
|
+
</div><table class="source_code">
|
1768
|
+
<tr>
|
1769
|
+
<td>
|
1770
|
+
<pre class="lines">
|
1771
|
+
|
1772
|
+
|
1773
|
+
39
|
1774
|
+
40
|
1775
|
+
41
|
1776
|
+
42
|
1777
|
+
43
|
1778
|
+
44
|
1779
|
+
45
|
1780
|
+
46
|
1781
|
+
47
|
1782
|
+
48
|
1783
|
+
49
|
1784
|
+
50</pre>
|
1785
|
+
</td>
|
1786
|
+
<td>
|
1787
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 39</span>
|
1788
|
+
|
1789
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize_dup'>initialize_dup</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
1790
|
+
<span class='ivar'>@parent_node</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1791
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</span>
|
1792
|
+
<span class='ivar'>@child_nodes</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1793
|
+
<span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_child_nodes'>child_nodes</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_n'>n</span><span class='op'>|</span>
|
1794
|
+
<span class='id identifier rubyid_new_node'>new_node</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1795
|
+
<span class='id identifier rubyid_new_node'>new_node</span><span class='period'>.</span><span class='id identifier rubyid_parent_node'>parent_node</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1796
|
+
<span class='ivar'>@child_nodes</span> <span class='op'><<</span> <span class='id identifier rubyid_new_node'>new_node</span>
|
1797
|
+
<span class='kw'>end</span>
|
1798
|
+
<span class='kw'>end</span>
|
1799
|
+
<span class='kw'>super</span>
|
1800
|
+
<span class='kw'>end</span></pre>
|
1801
|
+
</td>
|
1802
|
+
</tr>
|
1803
|
+
</table>
|
1804
|
+
</div>
|
1805
|
+
|
1806
|
+
<div class="method_details ">
|
1807
|
+
<h3 class="signature " id="leaf?-instance_method">
|
1808
|
+
|
1809
|
+
#<strong>leaf?</strong> ⇒ <tt>Boolean</tt>
|
1810
|
+
|
1811
|
+
|
1812
|
+
|
1813
|
+
|
1814
|
+
|
1815
|
+
</h3><div class="docstring">
|
1816
|
+
<div class="discussion">
|
1817
|
+
|
1818
|
+
<p>Tests whether this one is a leaf of the tree (i.e. has no child).</p>
|
1819
|
+
|
1820
|
+
|
1821
|
+
</div>
|
1822
|
+
</div>
|
1823
|
+
<div class="tags">
|
1824
|
+
|
1825
|
+
<p class="tag_title">Returns:</p>
|
1826
|
+
<ul class="return">
|
1827
|
+
|
1828
|
+
<li>
|
1829
|
+
|
1830
|
+
|
1831
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1832
|
+
|
1833
|
+
|
1834
|
+
|
1835
|
+
</li>
|
1836
|
+
|
1837
|
+
</ul>
|
1838
|
+
|
1839
|
+
</div><table class="source_code">
|
1840
|
+
<tr>
|
1841
|
+
<td>
|
1842
|
+
<pre class="lines">
|
1843
|
+
|
1844
|
+
|
1845
|
+
58
|
1846
|
+
59
|
1847
|
+
60</pre>
|
1848
|
+
</td>
|
1849
|
+
<td>
|
1850
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 58</span>
|
1851
|
+
|
1852
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_leaf?'>leaf?</span>
|
1853
|
+
<span class='ivar'>@child_nodes</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1854
|
+
<span class='kw'>end</span></pre>
|
1855
|
+
</td>
|
1856
|
+
</tr>
|
1857
|
+
</table>
|
1858
|
+
</div>
|
1859
|
+
|
1860
|
+
<div class="method_details ">
|
1861
|
+
<h3 class="signature " id="node_exists?-instance_method">
|
1862
|
+
|
1863
|
+
#<strong>node_exists?</strong>(path) ⇒ <tt>Boolean</tt>
|
1864
|
+
|
1865
|
+
|
1866
|
+
|
1867
|
+
|
1868
|
+
|
1869
|
+
</h3><div class="docstring">
|
1870
|
+
<div class="discussion">
|
1871
|
+
|
1872
|
+
<p>Tests whether the node identified by a given path of keys exists.</p>
|
1873
|
+
|
1874
|
+
|
1875
|
+
</div>
|
1876
|
+
</div>
|
1877
|
+
<div class="tags">
|
1878
|
+
<p class="tag_title">Parameters:</p>
|
1879
|
+
<ul class="param">
|
1880
|
+
|
1881
|
+
<li>
|
1882
|
+
|
1883
|
+
<span class='name'>path</span>
|
1884
|
+
|
1885
|
+
|
1886
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1887
|
+
|
1888
|
+
|
1889
|
+
|
1890
|
+
</li>
|
1891
|
+
|
1892
|
+
</ul>
|
1893
|
+
|
1894
|
+
<p class="tag_title">Returns:</p>
|
1895
|
+
<ul class="return">
|
1896
|
+
|
1897
|
+
<li>
|
1898
|
+
|
1899
|
+
|
1900
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1901
|
+
|
1902
|
+
|
1903
|
+
|
1904
|
+
</li>
|
1905
|
+
|
1906
|
+
</ul>
|
1907
|
+
|
1908
|
+
</div><table class="source_code">
|
1909
|
+
<tr>
|
1910
|
+
<td>
|
1911
|
+
<pre class="lines">
|
1912
|
+
|
1913
|
+
|
1914
|
+
178
|
1915
|
+
179
|
1916
|
+
180</pre>
|
1917
|
+
</td>
|
1918
|
+
<td>
|
1919
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 178</span>
|
1920
|
+
|
1921
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_node_exists?'>node_exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1922
|
+
<span class='id identifier rubyid_find_node'>find_node</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='op'>!=</span> <span class='kw'>nil</span>
|
1923
|
+
<span class='kw'>end</span></pre>
|
1924
|
+
</td>
|
1925
|
+
</tr>
|
1926
|
+
</table>
|
1927
|
+
</div>
|
1928
|
+
|
1929
|
+
<div class="method_details ">
|
1930
|
+
<h3 class="signature " id="path-instance_method">
|
1931
|
+
|
1932
|
+
#<strong>path</strong> ⇒ <tt>Array<Object></tt>
|
1933
|
+
|
1934
|
+
|
1935
|
+
|
1936
|
+
|
1937
|
+
|
1938
|
+
</h3><div class="docstring">
|
1939
|
+
<div class="discussion">
|
1940
|
+
|
1941
|
+
<p>Builds the path of keys.</p>
|
1942
|
+
|
1943
|
+
|
1944
|
+
</div>
|
1945
|
+
</div>
|
1946
|
+
<div class="tags">
|
1947
|
+
|
1948
|
+
<p class="tag_title">Returns:</p>
|
1949
|
+
<ul class="return">
|
1950
|
+
|
1951
|
+
<li>
|
1952
|
+
|
1953
|
+
|
1954
|
+
<span class='type'>(<tt>Array<Object></tt>)</span>
|
1955
|
+
|
1956
|
+
|
1957
|
+
|
1958
|
+
</li>
|
1959
|
+
|
1960
|
+
</ul>
|
1961
|
+
|
1962
|
+
</div><table class="source_code">
|
1963
|
+
<tr>
|
1964
|
+
<td>
|
1965
|
+
<pre class="lines">
|
1966
|
+
|
1967
|
+
|
1968
|
+
82
|
1969
|
+
83
|
1970
|
+
84
|
1971
|
+
85
|
1972
|
+
86</pre>
|
1973
|
+
</td>
|
1974
|
+
<td>
|
1975
|
+
<pre class="code"><span class="info file"># File 'lib/term_utils/property_tree_node.rb', line 82</span>
|
1976
|
+
|
1977
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
1978
|
+
<span class='id identifier rubyid_p'>p</span> <span class='op'>=</span> <span class='ivar'>@parent_node</span> <span class='op'>?</span> <span class='ivar'>@parent_node</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1979
|
+
<span class='id identifier rubyid_p'>p</span> <span class='op'><<</span> <span class='ivar'>@key</span> <span class='kw'>if</span> <span class='ivar'>@key</span>
|
1980
|
+
<span class='id identifier rubyid_p'>p</span>
|
1981
|
+
<span class='kw'>end</span></pre>
|
1982
|
+
</td>
|
1983
|
+
</tr>
|
1984
|
+
</table>
|
1985
|
+
</div>
|
1986
|
+
|
1987
|
+
</div>
|
1988
|
+
|
1989
|
+
</div>
|
1990
|
+
|
1991
|
+
<div id="footer">
|
1992
|
+
Generated on Sun Nov 10 18:36:20 2019 by
|
1993
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1994
|
+
0.9.20 (ruby-2.6.5).
|
1995
|
+
</div>
|
1996
|
+
|
1997
|
+
</div>
|
1998
|
+
</body>
|
1999
|
+
</html>
|