tango-etl 0.0.1 → 0.1.1
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 → CHANGELOG.md} +5 -1
- data/{readme.md → README.md} +1 -1
- data/doc/Multidb/Balancer.html +202 -0
- data/doc/Multidb.html +184 -0
- data/doc/Tango/AbstractModel.html +608 -0
- data/doc/Tango/App.html +1334 -0
- data/doc/Tango/DatabaseLocker.html +541 -0
- data/doc/Tango/ETL/Dispatcher.html +465 -0
- data/doc/Tango/ETL/HandlerInterface.html +639 -0
- data/doc/Tango/ETL/OperatorInterface.html +494 -0
- data/doc/Tango/ETL.html +117 -0
- data/doc/Tango/Kernel.html +432 -0
- data/doc/Tango/LinkStack.html +737 -0
- data/doc/Tango/Resource/Buffer.html +565 -0
- data/doc/Tango/Resource/Cache.html +834 -0
- data/doc/Tango/Resource.html +117 -0
- data/doc/Tango.html +131 -0
- data/doc/_index.html +297 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +80 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +80 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +365 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/tango/abstract_model.rb +1 -0
- data/lib/tango/app.rb +4 -7
- data/lib/tango/database_locker.rb +23 -2
- data/lib/tango/etl/handler_interface.rb +12 -6
- data/lib/tango/resource/buffer.rb +7 -7
- data/lib/tango/resource/cache.rb +18 -13
- data/lib/tango/version.rb +1 -1
- data/test/support/lib/simple_handler.rb +5 -14
- data/test/unit/etl/test_dispatcher.rb +21 -5
- metadata +33 -6
- data/config/app.yml.sample +0 -6
- data/config/database.yml.sample +0 -27
@@ -0,0 +1,737 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Tango::LinkStack
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
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
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Tango/LinkStack.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (L)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Tango.html" title="Tango (module)">Tango</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">LinkStack</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Tango::LinkStack
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Tango::LinkStack</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/tango/link_stack.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Stack of links to be crawled</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
<p class="tag_title">Author:</p>
|
113
|
+
<ul class="author">
|
114
|
+
|
115
|
+
<li>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div class='inline'>
|
122
|
+
<p>Mckomo</p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
134
|
+
<ul class="summary">
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#host-instance_method" title="#host (instance method)">- (Object) <strong>host</strong> </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<span class="note title readonly">readonly</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'>
|
159
|
+
<p>Returns the value of attribute host.</p>
|
160
|
+
</div></span>
|
161
|
+
|
162
|
+
</li>
|
163
|
+
|
164
|
+
|
165
|
+
<li class="public ">
|
166
|
+
<span class="summary_signature">
|
167
|
+
|
168
|
+
<a href="#links-instance_method" title="#links (instance method)">- (Object) <strong>links</strong> </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="note title readonly">readonly</span>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<span class="summary_desc"><div class='inline'>
|
188
|
+
<p>Returns the value of attribute links.</p>
|
189
|
+
</div></span>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
|
194
|
+
<li class="public ">
|
195
|
+
<span class="summary_signature">
|
196
|
+
|
197
|
+
<a href="#shifted-instance_method" title="#shifted (instance method)">- (Object) <strong>shifted</strong> </a>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<span class="note title readonly">readonly</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'>
|
217
|
+
<p>Returns the value of attribute shifted.</p>
|
218
|
+
</div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
</ul>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<h2>
|
230
|
+
Instance Method Summary
|
231
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
232
|
+
</h2>
|
233
|
+
|
234
|
+
<ul class="summary">
|
235
|
+
|
236
|
+
<li class="public ">
|
237
|
+
<span class="summary_signature">
|
238
|
+
|
239
|
+
<a href="#append-instance_method" title="#append (instance method)">- (Array|String) <strong>append</strong>(links) </a>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
</span>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<span class="summary_desc"><div class='inline'>
|
254
|
+
<p>Append link/s to stack.</p>
|
255
|
+
</div></span>
|
256
|
+
|
257
|
+
</li>
|
258
|
+
|
259
|
+
|
260
|
+
<li class="public ">
|
261
|
+
<span class="summary_signature">
|
262
|
+
|
263
|
+
<a href="#has_links%3F-instance_method" title="#has_links? (instance method)">- (Boolean) <strong>has_links?</strong> </a>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</span>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<span class="summary_desc"><div class='inline'>
|
278
|
+
<p>Check if link stack still has links.</p>
|
279
|
+
</div></span>
|
280
|
+
|
281
|
+
</li>
|
282
|
+
|
283
|
+
|
284
|
+
<li class="public ">
|
285
|
+
<span class="summary_signature">
|
286
|
+
|
287
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (LinkStack) <strong>initialize</strong>(base_link) </a>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
</span>
|
292
|
+
|
293
|
+
|
294
|
+
<span class="note title constructor">constructor</span>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<span class="summary_desc"><div class='inline'>
|
304
|
+
<p>A new instance of LinkStack.</p>
|
305
|
+
</div></span>
|
306
|
+
|
307
|
+
</li>
|
308
|
+
|
309
|
+
|
310
|
+
<li class="public ">
|
311
|
+
<span class="summary_signature">
|
312
|
+
|
313
|
+
<a href="#shift-instance_method" title="#shift (instance method)">- (String) <strong>shift</strong> </a>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<span class="summary_desc"><div class='inline'>
|
328
|
+
<p>Shift link from stack and get referrer content.</p>
|
329
|
+
</div></span>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
|
334
|
+
</ul>
|
335
|
+
|
336
|
+
|
337
|
+
<div id="constructor_details" class="method_details_list">
|
338
|
+
<h2>Constructor Details</h2>
|
339
|
+
|
340
|
+
<div class="method_details first">
|
341
|
+
<h3 class="signature first" id="initialize-instance_method">
|
342
|
+
|
343
|
+
- (<tt><span class='object_link'><a href="" title="Tango::LinkStack (class)">LinkStack</a></span></tt>) <strong>initialize</strong>(base_link)
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
</h3><div class="docstring">
|
350
|
+
<div class="discussion">
|
351
|
+
|
352
|
+
<p>Returns a new instance of LinkStack</p>
|
353
|
+
|
354
|
+
|
355
|
+
</div>
|
356
|
+
</div>
|
357
|
+
<div class="tags">
|
358
|
+
|
359
|
+
|
360
|
+
</div><table class="source_code">
|
361
|
+
<tr>
|
362
|
+
<td>
|
363
|
+
<pre class="lines">
|
364
|
+
|
365
|
+
|
366
|
+
13
|
367
|
+
14
|
368
|
+
15
|
369
|
+
16
|
370
|
+
17
|
371
|
+
18
|
372
|
+
19
|
373
|
+
20
|
374
|
+
21
|
375
|
+
22
|
376
|
+
23
|
377
|
+
24
|
378
|
+
25
|
379
|
+
26
|
380
|
+
27
|
381
|
+
28
|
382
|
+
29
|
383
|
+
30</pre>
|
384
|
+
</td>
|
385
|
+
<td>
|
386
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 13</span>
|
387
|
+
|
388
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_base_link'>base_link</span> <span class='rparen'>)</span>
|
389
|
+
|
390
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_base_link'>base_link</span> <span class='op'>!~</span> <span class='const'>URI</span><span class='op'>::</span><span class='id identifier rubyid_regexp'>regexp</span>
|
391
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>'</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_base_link'>base_link</span><span class='embexpr_end'>}</span><span class='tstring_content'>' is not valid website URL.</span><span class='tstring_end'>"</span></span>
|
392
|
+
<span class='kw'>end</span>
|
393
|
+
|
394
|
+
<span class='comment'># Parse base link
|
395
|
+
</span> <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span> <span class='id identifier rubyid_base_link'>base_link</span> <span class='rparen'>)</span>
|
396
|
+
|
397
|
+
<span class='ivar'>@host</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span><span class='embexpr_end'>}</span><span class='tstring_content'>://</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='comment'># Extract host from base link
|
398
|
+
</span> <span class='ivar'>@links</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='comment'># Container for links (without host part)
|
399
|
+
</span> <span class='ivar'>@shifted</span> <span class='op'>=</span> <span class='int'>0</span> <span class='comment'># Shifted links counter
|
400
|
+
</span>
|
401
|
+
<span class='comment'># Extract path (with query) from base link and append it as initial link
|
402
|
+
</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>?</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
|
403
|
+
<span class='id identifier rubyid_append'>append</span><span class='lparen'>(</span> <span class='id identifier rubyid_path'>path</span> <span class='rparen'>)</span>
|
404
|
+
|
405
|
+
<span class='kw'>end</span></pre>
|
406
|
+
</td>
|
407
|
+
</tr>
|
408
|
+
</table>
|
409
|
+
</div>
|
410
|
+
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div id="instance_attr_details" class="attr_details">
|
414
|
+
<h2>Instance Attribute Details</h2>
|
415
|
+
|
416
|
+
|
417
|
+
<span id=""></span>
|
418
|
+
<div class="method_details first">
|
419
|
+
<h3 class="signature first" id="host-instance_method">
|
420
|
+
|
421
|
+
- (<tt>Object</tt>) <strong>host</strong> <span class="extras">(readonly)</span>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
</h3><div class="docstring">
|
428
|
+
<div class="discussion">
|
429
|
+
|
430
|
+
<p>Returns the value of attribute host</p>
|
431
|
+
|
432
|
+
|
433
|
+
</div>
|
434
|
+
</div>
|
435
|
+
<div class="tags">
|
436
|
+
|
437
|
+
|
438
|
+
</div><table class="source_code">
|
439
|
+
<tr>
|
440
|
+
<td>
|
441
|
+
<pre class="lines">
|
442
|
+
|
443
|
+
|
444
|
+
11
|
445
|
+
12
|
446
|
+
13</pre>
|
447
|
+
</td>
|
448
|
+
<td>
|
449
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 11</span>
|
450
|
+
|
451
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_host'>host</span>
|
452
|
+
<span class='ivar'>@host</span>
|
453
|
+
<span class='kw'>end</span></pre>
|
454
|
+
</td>
|
455
|
+
</tr>
|
456
|
+
</table>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
|
460
|
+
<span id=""></span>
|
461
|
+
<div class="method_details ">
|
462
|
+
<h3 class="signature " id="links-instance_method">
|
463
|
+
|
464
|
+
- (<tt>Object</tt>) <strong>links</strong> <span class="extras">(readonly)</span>
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
</h3><div class="docstring">
|
471
|
+
<div class="discussion">
|
472
|
+
|
473
|
+
<p>Returns the value of attribute links</p>
|
474
|
+
|
475
|
+
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
<div class="tags">
|
479
|
+
|
480
|
+
|
481
|
+
</div><table class="source_code">
|
482
|
+
<tr>
|
483
|
+
<td>
|
484
|
+
<pre class="lines">
|
485
|
+
|
486
|
+
|
487
|
+
11
|
488
|
+
12
|
489
|
+
13</pre>
|
490
|
+
</td>
|
491
|
+
<td>
|
492
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 11</span>
|
493
|
+
|
494
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_links'>links</span>
|
495
|
+
<span class='ivar'>@links</span>
|
496
|
+
<span class='kw'>end</span></pre>
|
497
|
+
</td>
|
498
|
+
</tr>
|
499
|
+
</table>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
|
503
|
+
<span id=""></span>
|
504
|
+
<div class="method_details ">
|
505
|
+
<h3 class="signature " id="shifted-instance_method">
|
506
|
+
|
507
|
+
- (<tt>Object</tt>) <strong>shifted</strong> <span class="extras">(readonly)</span>
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
</h3><div class="docstring">
|
514
|
+
<div class="discussion">
|
515
|
+
|
516
|
+
<p>Returns the value of attribute shifted</p>
|
517
|
+
|
518
|
+
|
519
|
+
</div>
|
520
|
+
</div>
|
521
|
+
<div class="tags">
|
522
|
+
|
523
|
+
|
524
|
+
</div><table class="source_code">
|
525
|
+
<tr>
|
526
|
+
<td>
|
527
|
+
<pre class="lines">
|
528
|
+
|
529
|
+
|
530
|
+
11
|
531
|
+
12
|
532
|
+
13</pre>
|
533
|
+
</td>
|
534
|
+
<td>
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 11</span>
|
536
|
+
|
537
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_shifted'>shifted</span>
|
538
|
+
<span class='ivar'>@shifted</span>
|
539
|
+
<span class='kw'>end</span></pre>
|
540
|
+
</td>
|
541
|
+
</tr>
|
542
|
+
</table>
|
543
|
+
</div>
|
544
|
+
|
545
|
+
</div>
|
546
|
+
|
547
|
+
|
548
|
+
<div id="instance_method_details" class="method_details_list">
|
549
|
+
<h2>Instance Method Details</h2>
|
550
|
+
|
551
|
+
|
552
|
+
<div class="method_details first">
|
553
|
+
<h3 class="signature first" id="append-instance_method">
|
554
|
+
|
555
|
+
- (<tt>Array|String</tt>) <strong>append</strong>(links)
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
</h3><div class="docstring">
|
562
|
+
<div class="discussion">
|
563
|
+
|
564
|
+
<p>Append link/s to stack</p>
|
565
|
+
|
566
|
+
|
567
|
+
</div>
|
568
|
+
</div>
|
569
|
+
<div class="tags">
|
570
|
+
|
571
|
+
<p class="tag_title">Returns:</p>
|
572
|
+
<ul class="return">
|
573
|
+
|
574
|
+
<li>
|
575
|
+
|
576
|
+
|
577
|
+
<span class='type'>(<tt>Array|String</tt>)</span>
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
</li>
|
582
|
+
|
583
|
+
</ul>
|
584
|
+
|
585
|
+
</div><table class="source_code">
|
586
|
+
<tr>
|
587
|
+
<td>
|
588
|
+
<pre class="lines">
|
589
|
+
|
590
|
+
|
591
|
+
45
|
592
|
+
46
|
593
|
+
47
|
594
|
+
48
|
595
|
+
49
|
596
|
+
50
|
597
|
+
51</pre>
|
598
|
+
</td>
|
599
|
+
<td>
|
600
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 45</span>
|
601
|
+
|
602
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_append'>append</span><span class='lparen'>(</span> <span class='id identifier rubyid_links'>links</span> <span class='rparen'>)</span>
|
603
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
604
|
+
<span class='ivar'>@links</span> <span class='op'><<</span> <span class='id identifier rubyid_links'>links</span>
|
605
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_links'>links</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
606
|
+
<span class='ivar'>@links</span> <span class='op'>+=</span> <span class='id identifier rubyid_links'>links</span>
|
607
|
+
<span class='kw'>end</span>
|
608
|
+
<span class='kw'>end</span></pre>
|
609
|
+
</td>
|
610
|
+
</tr>
|
611
|
+
</table>
|
612
|
+
</div>
|
613
|
+
|
614
|
+
<div class="method_details ">
|
615
|
+
<h3 class="signature " id="has_links?-instance_method">
|
616
|
+
|
617
|
+
- (<tt>Boolean</tt>) <strong>has_links?</strong>
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</h3><div class="docstring">
|
624
|
+
<div class="discussion">
|
625
|
+
|
626
|
+
<p>Check if link stack still has links</p>
|
627
|
+
|
628
|
+
|
629
|
+
</div>
|
630
|
+
</div>
|
631
|
+
<div class="tags">
|
632
|
+
|
633
|
+
<p class="tag_title">Returns:</p>
|
634
|
+
<ul class="return">
|
635
|
+
|
636
|
+
<li>
|
637
|
+
|
638
|
+
|
639
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
</li>
|
644
|
+
|
645
|
+
</ul>
|
646
|
+
|
647
|
+
</div><table class="source_code">
|
648
|
+
<tr>
|
649
|
+
<td>
|
650
|
+
<pre class="lines">
|
651
|
+
|
652
|
+
|
653
|
+
56
|
654
|
+
57
|
655
|
+
58</pre>
|
656
|
+
</td>
|
657
|
+
<td>
|
658
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 56</span>
|
659
|
+
|
660
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_has_links?'>has_links?</span>
|
661
|
+
<span class='op'>!</span> <span class='ivar'>@links</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
662
|
+
<span class='kw'>end</span></pre>
|
663
|
+
</td>
|
664
|
+
</tr>
|
665
|
+
</table>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<div class="method_details ">
|
669
|
+
<h3 class="signature " id="shift-instance_method">
|
670
|
+
|
671
|
+
- (<tt>String</tt>) <strong>shift</strong>
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
</h3><div class="docstring">
|
678
|
+
<div class="discussion">
|
679
|
+
|
680
|
+
<p>Shift link from stack and get referrer content</p>
|
681
|
+
|
682
|
+
|
683
|
+
</div>
|
684
|
+
</div>
|
685
|
+
<div class="tags">
|
686
|
+
|
687
|
+
<p class="tag_title">Returns:</p>
|
688
|
+
<ul class="return">
|
689
|
+
|
690
|
+
<li>
|
691
|
+
|
692
|
+
|
693
|
+
<span class='type'>(<tt>String</tt>)</span>
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
</li>
|
698
|
+
|
699
|
+
</ul>
|
700
|
+
|
701
|
+
</div><table class="source_code">
|
702
|
+
<tr>
|
703
|
+
<td>
|
704
|
+
<pre class="lines">
|
705
|
+
|
706
|
+
|
707
|
+
35
|
708
|
+
36
|
709
|
+
37
|
710
|
+
38
|
711
|
+
39</pre>
|
712
|
+
</td>
|
713
|
+
<td>
|
714
|
+
<pre class="code"><span class="info file"># File 'lib/tango/link_stack.rb', line 35</span>
|
715
|
+
|
716
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span>
|
717
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_has_links?'>has_links?</span>
|
718
|
+
<span class='ivar'>@shifted</span> <span class='op'>+=</span> <span class='int'>1</span>
|
719
|
+
<span class='ivar'>@links</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
720
|
+
<span class='kw'>end</span></pre>
|
721
|
+
</td>
|
722
|
+
</tr>
|
723
|
+
</table>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
</div>
|
727
|
+
|
728
|
+
</div>
|
729
|
+
|
730
|
+
<div id="footer">
|
731
|
+
Generated on Tue Apr 15 02:47:42 2014 by
|
732
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
733
|
+
0.8.7.4 (ruby-2.0.0).
|
734
|
+
</div>
|
735
|
+
|
736
|
+
</body>
|
737
|
+
</html>
|