rrtf 0.1.1 → 0.1.2
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/README.md +31 -7
- data/documentation/RRTF/CharacterFormatting.html +1002 -0
- data/documentation/RRTF/CharacterStyle.html +1058 -0
- data/documentation/RRTF/Colour.html +813 -0
- data/documentation/RRTF/ColourTable.html +770 -0
- data/documentation/RRTF/CommandNode.html +2372 -0
- data/documentation/RRTF/ContainerNode.html +826 -0
- data/documentation/RRTF/Converters/HTML/Helpers.html +272 -0
- data/documentation/RRTF/Converters/HTML/Node.html +364 -0
- data/documentation/RRTF/Converters/HTML/NodeSet.html +265 -0
- data/documentation/RRTF/Converters/HTML.html +337 -0
- data/documentation/RRTF/Converters.html +117 -0
- data/documentation/RRTF/Document.html +2405 -0
- data/documentation/RRTF/DocumentStyle.html +1367 -0
- data/documentation/RRTF/Font.html +790 -0
- data/documentation/RRTF/FontTable.html +763 -0
- data/documentation/RRTF/FooterNode.html +515 -0
- data/documentation/RRTF/HeaderNode.html +515 -0
- data/documentation/RRTF/ImageNode.html +1374 -0
- data/documentation/RRTF/Information.html +809 -0
- data/documentation/RRTF/LinkNode.html +264 -0
- data/documentation/RRTF/ListLevel.html +799 -0
- data/documentation/RRTF/ListLevelNode.html +612 -0
- data/documentation/RRTF/ListMarker.html +595 -0
- data/documentation/RRTF/ListNode.html +368 -0
- data/documentation/RRTF/ListTable.html +343 -0
- data/documentation/RRTF/ListTemplate.html +433 -0
- data/documentation/RRTF/ListTextNode.html +285 -0
- data/documentation/RRTF/Node.html +616 -0
- data/documentation/RRTF/Paper.html +624 -0
- data/documentation/RRTF/ParagraphFormatting.html +749 -0
- data/documentation/RRTF/ParagraphNode.html +275 -0
- data/documentation/RRTF/ParagraphStyle.html +1319 -0
- data/documentation/RRTF/RTFError.html +295 -0
- data/documentation/RRTF/Style.html +1767 -0
- data/documentation/RRTF/Stylesheet.html +1768 -0
- data/documentation/RRTF/TableCellNode.html +1704 -0
- data/documentation/RRTF/TableNode.html +1025 -0
- data/documentation/RRTF/TableRowNode.html +675 -0
- data/documentation/RRTF/TextNode.html +600 -0
- data/documentation/RRTF/Utilities.html +201 -0
- data/documentation/RRTF.html +129 -0
- data/documentation/_index.html +478 -0
- data/documentation/class_list.html +51 -0
- data/documentation/css/common.css +1 -0
- data/documentation/css/full_list.css +58 -0
- data/documentation/css/style.css +492 -0
- data/documentation/file.README.html +223 -0
- data/documentation/file_list.html +56 -0
- data/documentation/frames.html +17 -0
- data/documentation/index.html +223 -0
- data/documentation/js/app.js +248 -0
- data/documentation/js/full_list.js +216 -0
- data/documentation/js/jquery.js +4 -0
- data/documentation/method_list.html +2203 -0
- data/documentation/top-level-namespace.html +110 -0
- data/examples/01.rtf +14 -17
- data/examples/01_mac_word15_36.png +0 -0
- data/examples/01_styles_and_paragraphs.rb +3 -4
- data/examples/resources/json/redshirt_styles.json +4 -2
- data/lib/rrtf/node.rb +86 -167
- data/lib/rrtf/style/character_style.rb +4 -3
- data/lib/rrtf/style/formatting.rb +55 -11
- data/lib/rrtf/style/paragraph_style.rb +19 -4
- data/lib/rrtf/style/style.rb +15 -15
- data/lib/rrtf/stylesheet.rb +57 -16
- data/lib/rrtf/version.rb +1 -1
- data/rrtf.gemspec +1 -0
- metadata +70 -1
@@ -0,0 +1,616 @@
|
|
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: RRTF::Node
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
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 = "RRTF::Node";
|
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 (N)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../RRTF.html" title="RRTF (module)">RRTF</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Node</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: RRTF::Node
|
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">RRTF::Node</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/rrtf/node.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>This class represents an element within an RTF document. The class provides
|
106
|
+
a base class for more specific node types.</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div><div id="subclasses">
|
115
|
+
<h2>Direct Known Subclasses</h2>
|
116
|
+
<p class="children"><span class='object_link'><a href="ContainerNode.html" title="RRTF::ContainerNode (class)">ContainerNode</a></span>, <span class='object_link'><a href="ImageNode.html" title="RRTF::ImageNode (class)">ImageNode</a></span>, <span class='object_link'><a href="TextNode.html" title="RRTF::TextNode (class)">TextNode</a></span></p>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
123
|
+
<ul class="summary">
|
124
|
+
|
125
|
+
<li class="public ">
|
126
|
+
<span class="summary_signature">
|
127
|
+
|
128
|
+
<a href="#parent-instance_method" title="#parent (instance method)">#<strong>parent</strong> ⇒ Object </a>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'>
|
146
|
+
<p>Node parent.</p>
|
147
|
+
</div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
</ul>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<h2>
|
159
|
+
Instance Method Summary
|
160
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
161
|
+
</h2>
|
162
|
+
|
163
|
+
<ul class="summary">
|
164
|
+
|
165
|
+
<li class="public ">
|
166
|
+
<span class="summary_signature">
|
167
|
+
|
168
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(parent) ⇒ Node </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
<span class="note title constructor">constructor</span>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'>
|
185
|
+
<p>Constructor for the Node class.</p>
|
186
|
+
</div></span>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#is_root%3F-instance_method" title="#is_root? (instance method)">#<strong>is_root?</strong> ⇒ Boolean </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<span class="summary_desc"><div class='inline'>
|
209
|
+
<p>This method is used to determine whether a Node object represents a root or
|
210
|
+
base element.</p>
|
211
|
+
</div></span>
|
212
|
+
|
213
|
+
</li>
|
214
|
+
|
215
|
+
|
216
|
+
<li class="public ">
|
217
|
+
<span class="summary_signature">
|
218
|
+
|
219
|
+
<a href="#next_node-instance_method" title="#next_node (instance method)">#<strong>next_node</strong> ⇒ Object </a>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</span>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<span class="summary_desc"><div class='inline'>
|
234
|
+
<p>This method retrieves a Node objects next peer node, returning nil if the
|
235
|
+
Node has no previous peer.</p>
|
236
|
+
</div></span>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
<li class="public ">
|
242
|
+
<span class="summary_signature">
|
243
|
+
|
244
|
+
<a href="#previous_node-instance_method" title="#previous_node (instance method)">#<strong>previous_node</strong> ⇒ Object </a>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</span>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
<span class="summary_desc"><div class='inline'>
|
259
|
+
<p>This method retrieves a Node objects previous peer node, returning nil if
|
260
|
+
the Node has no previous peer.</p>
|
261
|
+
</div></span>
|
262
|
+
|
263
|
+
</li>
|
264
|
+
|
265
|
+
|
266
|
+
<li class="public ">
|
267
|
+
<span class="summary_signature">
|
268
|
+
|
269
|
+
<a href="#root-instance_method" title="#root (instance method)">#<strong>root</strong> ⇒ Object </a>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
</span>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<span class="summary_desc"><div class='inline'>
|
284
|
+
<p>This method traverses a Node tree to locate the root element.</p>
|
285
|
+
</div></span>
|
286
|
+
|
287
|
+
</li>
|
288
|
+
|
289
|
+
|
290
|
+
</ul>
|
291
|
+
|
292
|
+
|
293
|
+
<div id="constructor_details" class="method_details_list">
|
294
|
+
<h2>Constructor Details</h2>
|
295
|
+
|
296
|
+
<div class="method_details first">
|
297
|
+
<h3 class="signature first" id="initialize-instance_method">
|
298
|
+
|
299
|
+
#<strong>initialize</strong>(parent) ⇒ <tt><span class='object_link'><a href="" title="RRTF::Node (class)">Node</a></span></tt>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</h3><div class="docstring">
|
306
|
+
<div class="discussion">
|
307
|
+
|
308
|
+
<p>Constructor for the Node class.</p>
|
309
|
+
|
310
|
+
<h4 id="label-Parameters">Parameters</h4>
|
311
|
+
<dl class="rdoc-list note-list"><dt>parent
|
312
|
+
<dd>
|
313
|
+
<p>A reference to the Node that owns the new Node. May be nil to indicate a
|
314
|
+
base or root node.</p>
|
315
|
+
</dd></dl>
|
316
|
+
|
317
|
+
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
<div class="tags">
|
321
|
+
|
322
|
+
|
323
|
+
</div><table class="source_code">
|
324
|
+
<tr>
|
325
|
+
<td>
|
326
|
+
<pre class="lines">
|
327
|
+
|
328
|
+
|
329
|
+
15
|
330
|
+
16
|
331
|
+
17</pre>
|
332
|
+
</td>
|
333
|
+
<td>
|
334
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 15</span>
|
335
|
+
|
336
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_parent'>parent</span><span class='rparen'>)</span>
|
337
|
+
<span class='ivar'>@parent</span> <span class='op'>=</span> <span class='id identifier rubyid_parent'>parent</span>
|
338
|
+
<span class='kw'>end</span></pre>
|
339
|
+
</td>
|
340
|
+
</tr>
|
341
|
+
</table>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
</div>
|
345
|
+
|
346
|
+
<div id="instance_attr_details" class="attr_details">
|
347
|
+
<h2>Instance Attribute Details</h2>
|
348
|
+
|
349
|
+
|
350
|
+
<span id="parent=-instance_method"></span>
|
351
|
+
<div class="method_details first">
|
352
|
+
<h3 class="signature first" id="parent-instance_method">
|
353
|
+
|
354
|
+
#<strong>parent</strong> ⇒ <tt>Object</tt>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</h3><div class="docstring">
|
361
|
+
<div class="discussion">
|
362
|
+
|
363
|
+
<p>Node parent.</p>
|
364
|
+
|
365
|
+
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
<div class="tags">
|
369
|
+
|
370
|
+
|
371
|
+
</div><table class="source_code">
|
372
|
+
<tr>
|
373
|
+
<td>
|
374
|
+
<pre class="lines">
|
375
|
+
|
376
|
+
|
377
|
+
8
|
378
|
+
9
|
379
|
+
10</pre>
|
380
|
+
</td>
|
381
|
+
<td>
|
382
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 8</span>
|
383
|
+
|
384
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parent'>parent</span>
|
385
|
+
<span class='ivar'>@parent</span>
|
386
|
+
<span class='kw'>end</span></pre>
|
387
|
+
</td>
|
388
|
+
</tr>
|
389
|
+
</table>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</div>
|
393
|
+
|
394
|
+
|
395
|
+
<div id="instance_method_details" class="method_details_list">
|
396
|
+
<h2>Instance Method Details</h2>
|
397
|
+
|
398
|
+
|
399
|
+
<div class="method_details first">
|
400
|
+
<h3 class="signature first" id="is_root?-instance_method">
|
401
|
+
|
402
|
+
#<strong>is_root?</strong> ⇒ <tt>Boolean</tt>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</h3><div class="docstring">
|
409
|
+
<div class="discussion">
|
410
|
+
|
411
|
+
<p>This method is used to determine whether a Node object represents a root or
|
412
|
+
base element. The method returns true if the Nodes parent is nil, false
|
413
|
+
otherwise.</p>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<div class="tags">
|
419
|
+
|
420
|
+
<p class="tag_title">Returns:</p>
|
421
|
+
<ul class="return">
|
422
|
+
|
423
|
+
<li>
|
424
|
+
|
425
|
+
|
426
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
</li>
|
431
|
+
|
432
|
+
</ul>
|
433
|
+
|
434
|
+
</div><table class="source_code">
|
435
|
+
<tr>
|
436
|
+
<td>
|
437
|
+
<pre class="lines">
|
438
|
+
|
439
|
+
|
440
|
+
44
|
441
|
+
45
|
442
|
+
46</pre>
|
443
|
+
</td>
|
444
|
+
<td>
|
445
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 44</span>
|
446
|
+
|
447
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_root?'>is_root?</span>
|
448
|
+
<span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
449
|
+
<span class='kw'>end</span></pre>
|
450
|
+
</td>
|
451
|
+
</tr>
|
452
|
+
</table>
|
453
|
+
</div>
|
454
|
+
|
455
|
+
<div class="method_details ">
|
456
|
+
<h3 class="signature " id="next_node-instance_method">
|
457
|
+
|
458
|
+
#<strong>next_node</strong> ⇒ <tt>Object</tt>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
</h3><div class="docstring">
|
465
|
+
<div class="discussion">
|
466
|
+
|
467
|
+
<p>This method retrieves a Node objects next peer node, returning nil if the
|
468
|
+
Node has no previous peer.</p>
|
469
|
+
|
470
|
+
|
471
|
+
</div>
|
472
|
+
</div>
|
473
|
+
<div class="tags">
|
474
|
+
|
475
|
+
|
476
|
+
</div><table class="source_code">
|
477
|
+
<tr>
|
478
|
+
<td>
|
479
|
+
<pre class="lines">
|
480
|
+
|
481
|
+
|
482
|
+
32
|
483
|
+
33
|
484
|
+
34
|
485
|
+
35
|
486
|
+
36
|
487
|
+
37
|
488
|
+
38
|
489
|
+
39</pre>
|
490
|
+
</td>
|
491
|
+
<td>
|
492
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 32</span>
|
493
|
+
|
494
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_next_node'>next_node</span>
|
495
|
+
<span class='id identifier rubyid_peer'>peer</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
496
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:children</span><span class='rparen'>)</span>
|
497
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_children'>children</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
498
|
+
<span class='id identifier rubyid_peer'>peer</span> <span class='op'>=</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_children'>children</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span> <span class='op'>+</span> <span class='int'>1</span><span class='rbracket'>]</span>
|
499
|
+
<span class='kw'>end</span>
|
500
|
+
<span class='id identifier rubyid_peer'>peer</span>
|
501
|
+
<span class='kw'>end</span></pre>
|
502
|
+
</td>
|
503
|
+
</tr>
|
504
|
+
</table>
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div class="method_details ">
|
508
|
+
<h3 class="signature " id="previous_node-instance_method">
|
509
|
+
|
510
|
+
#<strong>previous_node</strong> ⇒ <tt>Object</tt>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
</h3><div class="docstring">
|
517
|
+
<div class="discussion">
|
518
|
+
|
519
|
+
<p>This method retrieves a Node objects previous peer node, returning nil if
|
520
|
+
the Node has no previous peer.</p>
|
521
|
+
|
522
|
+
|
523
|
+
</div>
|
524
|
+
</div>
|
525
|
+
<div class="tags">
|
526
|
+
|
527
|
+
|
528
|
+
</div><table class="source_code">
|
529
|
+
<tr>
|
530
|
+
<td>
|
531
|
+
<pre class="lines">
|
532
|
+
|
533
|
+
|
534
|
+
21
|
535
|
+
22
|
536
|
+
23
|
537
|
+
24
|
538
|
+
25
|
539
|
+
26
|
540
|
+
27
|
541
|
+
28</pre>
|
542
|
+
</td>
|
543
|
+
<td>
|
544
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 21</span>
|
545
|
+
|
546
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_previous_node'>previous_node</span>
|
547
|
+
<span class='id identifier rubyid_peer'>peer</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
548
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:children</span><span class='rparen'>)</span>
|
549
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_children'>children</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
550
|
+
<span class='id identifier rubyid_peer'>peer</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span> <span class='op'>></span> <span class='int'>0</span> <span class='op'>?</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_children'>children</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
551
|
+
<span class='kw'>end</span>
|
552
|
+
<span class='id identifier rubyid_peer'>peer</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="root-instance_method">
|
561
|
+
|
562
|
+
#<strong>root</strong> ⇒ <tt>Object</tt>
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
</h3><div class="docstring">
|
569
|
+
<div class="discussion">
|
570
|
+
|
571
|
+
<p>This method traverses a Node tree to locate the root element.</p>
|
572
|
+
|
573
|
+
|
574
|
+
</div>
|
575
|
+
</div>
|
576
|
+
<div class="tags">
|
577
|
+
|
578
|
+
|
579
|
+
</div><table class="source_code">
|
580
|
+
<tr>
|
581
|
+
<td>
|
582
|
+
<pre class="lines">
|
583
|
+
|
584
|
+
|
585
|
+
49
|
586
|
+
50
|
587
|
+
51
|
588
|
+
52
|
589
|
+
53</pre>
|
590
|
+
</td>
|
591
|
+
<td>
|
592
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/node.rb', line 49</span>
|
593
|
+
|
594
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_root'><span class='object_link'><a href="../top-level-namespace.html" title="Top Level Namespace (root)">root</a></span></span>
|
595
|
+
<span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='kw'>self</span>
|
596
|
+
<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_parent'>parent</span> <span class='kw'>while</span> <span class='op'>!</span><span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
597
|
+
<span class='id identifier rubyid_node'>node</span>
|
598
|
+
<span class='kw'>end</span></pre>
|
599
|
+
</td>
|
600
|
+
</tr>
|
601
|
+
</table>
|
602
|
+
</div>
|
603
|
+
|
604
|
+
</div>
|
605
|
+
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div id="footer">
|
609
|
+
Generated on Mon Jul 24 15:48:59 2017 by
|
610
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
611
|
+
0.9.9 (ruby-2.3.3).
|
612
|
+
</div>
|
613
|
+
|
614
|
+
</div>
|
615
|
+
</body>
|
616
|
+
</html>
|