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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/{changelog.md → CHANGELOG.md} +5 -1
  3. data/{readme.md → README.md} +1 -1
  4. data/doc/Multidb/Balancer.html +202 -0
  5. data/doc/Multidb.html +184 -0
  6. data/doc/Tango/AbstractModel.html +608 -0
  7. data/doc/Tango/App.html +1334 -0
  8. data/doc/Tango/DatabaseLocker.html +541 -0
  9. data/doc/Tango/ETL/Dispatcher.html +465 -0
  10. data/doc/Tango/ETL/HandlerInterface.html +639 -0
  11. data/doc/Tango/ETL/OperatorInterface.html +494 -0
  12. data/doc/Tango/ETL.html +117 -0
  13. data/doc/Tango/Kernel.html +432 -0
  14. data/doc/Tango/LinkStack.html +737 -0
  15. data/doc/Tango/Resource/Buffer.html +565 -0
  16. data/doc/Tango/Resource/Cache.html +834 -0
  17. data/doc/Tango/Resource.html +117 -0
  18. data/doc/Tango.html +131 -0
  19. data/doc/_index.html +297 -0
  20. data/doc/class_list.html +54 -0
  21. data/doc/css/common.css +1 -0
  22. data/doc/css/full_list.css +57 -0
  23. data/doc/css/style.css +339 -0
  24. data/doc/file.README.html +80 -0
  25. data/doc/file_list.html +56 -0
  26. data/doc/frames.html +26 -0
  27. data/doc/index.html +80 -0
  28. data/doc/js/app.js +219 -0
  29. data/doc/js/full_list.js +178 -0
  30. data/doc/js/jquery.js +4 -0
  31. data/doc/method_list.html +365 -0
  32. data/doc/top-level-namespace.html +112 -0
  33. data/lib/tango/abstract_model.rb +1 -0
  34. data/lib/tango/app.rb +4 -7
  35. data/lib/tango/database_locker.rb +23 -2
  36. data/lib/tango/etl/handler_interface.rb +12 -6
  37. data/lib/tango/resource/buffer.rb +7 -7
  38. data/lib/tango/resource/cache.rb +18 -13
  39. data/lib/tango/version.rb +1 -1
  40. data/test/support/lib/simple_handler.rb +5 -14
  41. data/test/unit/etl/test_dispatcher.rb +21 -5
  42. metadata +33 -6
  43. data/config/app.yml.sample +0 -6
  44. data/config/database.yml.sample +0 -27
@@ -0,0 +1,365 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>Method List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <script type="text/javascript" charset="utf-8">
23
+ if (window.top.frames.main) {
24
+ document.getElementById('base_target').target = 'main';
25
+ document.body.className = 'frames';
26
+ }
27
+ </script>
28
+ <div id="content">
29
+ <h1 id="full_list_header">Method List</h1>
30
+ <div id="nav">
31
+
32
+ <span><a target="_self" href="class_list.html">
33
+ Classes
34
+ </a></span>
35
+
36
+ <span><a target="_self" href="method_list.html">
37
+ Methods
38
+ </a></span>
39
+
40
+ <span><a target="_self" href="file_list.html">
41
+ Files
42
+ </a></span>
43
+
44
+ </div>
45
+ <div id="search">Search: <input type="text" /></div>
46
+
47
+ <ul id="full_list" class="method">
48
+
49
+
50
+ <li class="r1 ">
51
+ <span class='object_link'><a href="Tango/App.html#after-instance_method" title="Tango::App#after (method)">#after</a></span>
52
+ <small>Tango::App</small>
53
+ </li>
54
+
55
+
56
+ <li class="r2 ">
57
+ <span class='object_link'><a href="Tango/LinkStack.html#append-instance_method" title="Tango::LinkStack#append (method)">#append</a></span>
58
+ <small>Tango::LinkStack</small>
59
+ </li>
60
+
61
+
62
+ <li class="r1 ">
63
+ <span class='object_link'><a href="Tango/ETL/HandlerInterface.html#applicable%3F-class_method" title="Tango::ETL::HandlerInterface.applicable? (method)">applicable?</a></span>
64
+ <small>Tango::ETL::HandlerInterface</small>
65
+ </li>
66
+
67
+
68
+ <li class="r2 ">
69
+ <span class='object_link'><a href="Tango/App.html#before-instance_method" title="Tango::App#before (method)">#before</a></span>
70
+ <small>Tango::App</small>
71
+ </li>
72
+
73
+
74
+ <li class="r1 ">
75
+ <span class='object_link'><a href="Tango/Resource/Cache.html#buffer-instance_method" title="Tango::Resource::Cache#buffer (method)">#buffer</a></span>
76
+ <small>Tango::Resource::Cache</small>
77
+ </li>
78
+
79
+
80
+ <li class="r2 ">
81
+ <span class='object_link'><a href="Tango/AbstractModel.html#cache_key-instance_method" title="Tango::AbstractModel#cache_key (method)">#cache_key</a></span>
82
+ <small>Tango::AbstractModel</small>
83
+ </li>
84
+
85
+
86
+ <li class="r1 ">
87
+ <span class='object_link'><a href="Multidb/Balancer.html#candidates-instance_method" title="Multidb::Balancer#candidates (method)">#candidates</a></span>
88
+ <small>Multidb::Balancer</small>
89
+ </li>
90
+
91
+
92
+ <li class="r2 ">
93
+ <span class='object_link'><a href="Tango/Kernel.html#classify-class_method" title="Tango::Kernel.classify (method)">classify</a></span>
94
+ <small>Tango::Kernel</small>
95
+ </li>
96
+
97
+
98
+ <li class="r1 ">
99
+ <span class='object_link'><a href="Tango/App.html#config-instance_method" title="Tango::App#config (method)">#config</a></span>
100
+ <small>Tango::App</small>
101
+ </li>
102
+
103
+
104
+ <li class="r2 ">
105
+ <span class='object_link'><a href="Multidb.html#databases-class_method" title="Multidb.databases (method)">databases</a></span>
106
+ <small>Multidb</small>
107
+ </li>
108
+
109
+
110
+ <li class="r1 ">
111
+ <span class='object_link'><a href="Tango/App.html#dispatcher-instance_method" title="Tango::App#dispatcher (method)">#dispatcher</a></span>
112
+ <small>Tango::App</small>
113
+ </li>
114
+
115
+
116
+ <li class="r2 ">
117
+ <span class='object_link'><a href="Tango/ETL/OperatorInterface.html#extract-class_method" title="Tango::ETL::OperatorInterface.extract (method)">extract</a></span>
118
+ <small>Tango::ETL::OperatorInterface</small>
119
+ </li>
120
+
121
+
122
+ <li class="r1 ">
123
+ <span class='object_link'><a href="Tango/Resource/Buffer.html#fill-instance_method" title="Tango::Resource::Buffer#fill (method)">#fill</a></span>
124
+ <small>Tango::Resource::Buffer</small>
125
+ </li>
126
+
127
+
128
+ <li class="r2 ">
129
+ <span class='object_link'><a href="Tango/ETL/Dispatcher.html#find_handler-instance_method" title="Tango::ETL::Dispatcher#find_handler (method)">#find_handler</a></span>
130
+ <small>Tango::ETL::Dispatcher</small>
131
+ </li>
132
+
133
+
134
+ <li class="r1 ">
135
+ <span class='object_link'><a href="Tango/Resource/Cache.html#get-instance_method" title="Tango::Resource::Cache#get (method)">#get</a></span>
136
+ <small>Tango::Resource::Cache</small>
137
+ </li>
138
+
139
+
140
+ <li class="r2 ">
141
+ <span class='object_link'><a href="Tango/LinkStack.html#has_links%3F-instance_method" title="Tango::LinkStack#has_links? (method)">#has_links?</a></span>
142
+ <small>Tango::LinkStack</small>
143
+ </li>
144
+
145
+
146
+ <li class="r1 ">
147
+ <span class='object_link'><a href="Tango/LinkStack.html#host-instance_method" title="Tango::LinkStack#host (method)">#host</a></span>
148
+ <small>Tango::LinkStack</small>
149
+ </li>
150
+
151
+
152
+ <li class="r2 ">
153
+ <span class='object_link'><a href="Tango/Resource/Buffer.html#initialize-instance_method" title="Tango::Resource::Buffer#initialize (method)">#initialize</a></span>
154
+ <small>Tango::Resource::Buffer</small>
155
+ </li>
156
+
157
+
158
+ <li class="r1 ">
159
+ <span class='object_link'><a href="Tango/LinkStack.html#initialize-instance_method" title="Tango::LinkStack#initialize (method)">#initialize</a></span>
160
+ <small>Tango::LinkStack</small>
161
+ </li>
162
+
163
+
164
+ <li class="r2 ">
165
+ <span class='object_link'><a href="Tango/DatabaseLocker.html#initialize-instance_method" title="Tango::DatabaseLocker#initialize (method)">#initialize</a></span>
166
+ <small>Tango::DatabaseLocker</small>
167
+ </li>
168
+
169
+
170
+ <li class="r1 ">
171
+ <span class='object_link'><a href="Tango/ETL/HandlerInterface.html#initialize-instance_method" title="Tango::ETL::HandlerInterface#initialize (method)">#initialize</a></span>
172
+ <small>Tango::ETL::HandlerInterface</small>
173
+ </li>
174
+
175
+
176
+ <li class="r2 ">
177
+ <span class='object_link'><a href="Tango/App.html#initialize-instance_method" title="Tango::App#initialize (method)">#initialize</a></span>
178
+ <small>Tango::App</small>
179
+ </li>
180
+
181
+
182
+ <li class="r1 ">
183
+ <span class='object_link'><a href="Tango/ETL/Dispatcher.html#initialize-instance_method" title="Tango::ETL::Dispatcher#initialize (method)">#initialize</a></span>
184
+ <small>Tango::ETL::Dispatcher</small>
185
+ </li>
186
+
187
+
188
+ <li class="r2 ">
189
+ <span class='object_link'><a href="Tango/Resource/Cache.html#initialize-instance_method" title="Tango::Resource::Cache#initialize (method)">#initialize</a></span>
190
+ <small>Tango::Resource::Cache</small>
191
+ </li>
192
+
193
+
194
+ <li class="r1 ">
195
+ <span class='object_link'><a href="Tango/App.html#link_stack-instance_method" title="Tango::App#link_stack (method)">#link_stack</a></span>
196
+ <small>Tango::App</small>
197
+ </li>
198
+
199
+
200
+ <li class="r2 ">
201
+ <span class='object_link'><a href="Tango/ETL/HandlerInterface.html#links-instance_method" title="Tango::ETL::HandlerInterface#links (method)">#links</a></span>
202
+ <small>Tango::ETL::HandlerInterface</small>
203
+ </li>
204
+
205
+
206
+ <li class="r1 ">
207
+ <span class='object_link'><a href="Tango/LinkStack.html#links-instance_method" title="Tango::LinkStack#links (method)">#links</a></span>
208
+ <small>Tango::LinkStack</small>
209
+ </li>
210
+
211
+
212
+ <li class="r2 ">
213
+ <span class='object_link'><a href="Tango/Kernel.html#load-class_method" title="Tango::Kernel.load (method)">load</a></span>
214
+ <small>Tango::Kernel</small>
215
+ </li>
216
+
217
+
218
+ <li class="r1 ">
219
+ <span class='object_link'><a href="Tango/Resource/Cache.html#load-instance_method" title="Tango::Resource::Cache#load (method)">#load</a></span>
220
+ <small>Tango::Resource::Cache</small>
221
+ </li>
222
+
223
+
224
+ <li class="r2 ">
225
+ <span class='object_link'><a href="Tango/ETL/OperatorInterface.html#load-class_method" title="Tango::ETL::OperatorInterface.load (method)">load</a></span>
226
+ <small>Tango::ETL::OperatorInterface</small>
227
+ </li>
228
+
229
+
230
+ <li class="r1 ">
231
+ <span class='object_link'><a href="Tango/DatabaseLocker.html#lock-instance_method" title="Tango::DatabaseLocker#lock (method)">#lock</a></span>
232
+ <small>Tango::DatabaseLocker</small>
233
+ </li>
234
+
235
+
236
+ <li class="r2 ">
237
+ <span class='object_link'><a href="Tango/DatabaseLocker.html#lock_path-instance_method" title="Tango::DatabaseLocker#lock_path (method)">#lock_path</a></span>
238
+ <small>Tango::DatabaseLocker</small>
239
+ </li>
240
+
241
+
242
+ <li class="r1 ">
243
+ <span class='object_link'><a href="Tango/App.html#logger-instance_method" title="Tango::App#logger (method)">#logger</a></span>
244
+ <small>Tango::App</small>
245
+ </li>
246
+
247
+
248
+ <li class="r2 ">
249
+ <span class='object_link'><a href="Tango/AbstractModel.html#next_id-class_method" title="Tango::AbstractModel.next_id (method)">next_id</a></span>
250
+ <small>Tango::AbstractModel</small>
251
+ </li>
252
+
253
+
254
+ <li class="r1 ">
255
+ <span class='object_link'><a href="Tango/AbstractModel.html#persistent%3F-class_method" title="Tango::AbstractModel.persistent? (method)">persistent?</a></span>
256
+ <small>Tango::AbstractModel</small>
257
+ </li>
258
+
259
+
260
+ <li class="r2 ">
261
+ <span class='object_link'><a href="Tango/AbstractModel.html#properties-class_method" title="Tango::AbstractModel.properties (method)">properties</a></span>
262
+ <small>Tango::AbstractModel</small>
263
+ </li>
264
+
265
+
266
+ <li class="r1 ">
267
+ <span class='object_link'><a href="Tango/Resource/Cache.html#register-instance_method" title="Tango::Resource::Cache#register (method)">#register</a></span>
268
+ <small>Tango::Resource::Cache</small>
269
+ </li>
270
+
271
+
272
+ <li class="r2 ">
273
+ <span class='object_link'><a href="Tango/Resource/Buffer.html#register-instance_method" title="Tango::Resource::Buffer#register (method)">#register</a></span>
274
+ <small>Tango::Resource::Buffer</small>
275
+ </li>
276
+
277
+
278
+ <li class="r1 ">
279
+ <span class='object_link'><a href="Tango/ETL/Dispatcher.html#register-instance_method" title="Tango::ETL::Dispatcher#register (method)">#register</a></span>
280
+ <small>Tango::ETL::Dispatcher</small>
281
+ </li>
282
+
283
+
284
+ <li class="r2 ">
285
+ <span class='object_link'><a href="Tango/App.html#register_model-instance_method" title="Tango::App#register_model (method)">#register_model</a></span>
286
+ <small>Tango::App</small>
287
+ </li>
288
+
289
+
290
+ <li class="r1 ">
291
+ <span class='object_link'><a href="Tango/App.html#register_operator-instance_method" title="Tango::App#register_operator (method)">#register_operator</a></span>
292
+ <small>Tango::App</small>
293
+ </li>
294
+
295
+
296
+ <li class="r2 ">
297
+ <span class='object_link'><a href="Tango/Resource/Buffer.html#release_all-instance_method" title="Tango::Resource::Buffer#release_all (method)">#release_all</a></span>
298
+ <small>Tango::Resource::Buffer</small>
299
+ </li>
300
+
301
+
302
+ <li class="r1 ">
303
+ <span class='object_link'><a href="Tango/App.html#run-instance_method" title="Tango::App#run (method)">#run</a></span>
304
+ <small>Tango::App</small>
305
+ </li>
306
+
307
+
308
+ <li class="r2 ">
309
+ <span class='object_link'><a href="Tango/Resource/Cache.html#set-instance_method" title="Tango::Resource::Cache#set (method)">#set</a></span>
310
+ <small>Tango::Resource::Cache</small>
311
+ </li>
312
+
313
+
314
+ <li class="r1 ">
315
+ <span class='object_link'><a href="Tango/LinkStack.html#shift-instance_method" title="Tango::LinkStack#shift (method)">#shift</a></span>
316
+ <small>Tango::LinkStack</small>
317
+ </li>
318
+
319
+
320
+ <li class="r2 ">
321
+ <span class='object_link'><a href="Tango/LinkStack.html#shifted-instance_method" title="Tango::LinkStack#shifted (method)">#shifted</a></span>
322
+ <small>Tango::LinkStack</small>
323
+ </li>
324
+
325
+
326
+ <li class="r1 ">
327
+ <span class='object_link'><a href="Tango/Kernel.html#symbolize-class_method" title="Tango::Kernel.symbolize (method)">symbolize</a></span>
328
+ <small>Tango::Kernel</small>
329
+ </li>
330
+
331
+
332
+ <li class="r2 ">
333
+ <span class='object_link'><a href="Tango/ETL/OperatorInterface.html#transform-class_method" title="Tango::ETL::OperatorInterface.transform (method)">transform</a></span>
334
+ <small>Tango::ETL::OperatorInterface</small>
335
+ </li>
336
+
337
+
338
+ <li class="r1 ">
339
+ <span class='object_link'><a href="Tango/ETL/HandlerInterface.html#trigger-instance_method" title="Tango::ETL::HandlerInterface#trigger (method)">#trigger</a></span>
340
+ <small>Tango::ETL::HandlerInterface</small>
341
+ </li>
342
+
343
+
344
+ <li class="r2 ">
345
+ <span class='object_link'><a href="Tango/DatabaseLocker.html#unlocked-instance_method" title="Tango::DatabaseLocker#unlocked (method)">#unlocked</a></span>
346
+ <small>Tango::DatabaseLocker</small>
347
+ </li>
348
+
349
+
350
+ <li class="r1 ">
351
+ <span class='object_link'><a href="Tango/ETL/HandlerInterface.html#url-instance_method" title="Tango::ETL::HandlerInterface#url (method)">#url</a></span>
352
+ <small>Tango::ETL::HandlerInterface</small>
353
+ </li>
354
+
355
+
356
+ <li class="r2 ">
357
+ <span class='object_link'><a href="Tango/AbstractModel.html#values-instance_method" title="Tango::AbstractModel#values (method)">#values</a></span>
358
+ <small>Tango::AbstractModel</small>
359
+ </li>
360
+
361
+
362
+ </ul>
363
+ </div>
364
+ </body>
365
+ </html>
@@ -0,0 +1,112 @@
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
+ Top Level Namespace
8
+
9
+ &mdash; 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#!top-level-namespace.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</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</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>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Defined Under Namespace</h2>
85
+ <p class="children">
86
+
87
+
88
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Multidb.html" title="Multidb (module)">Multidb</a></span>, <span class='object_link'><a href="Tango.html" title="Tango (module)">Tango</a></span>
89
+
90
+
91
+
92
+
93
+ </p>
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ </div>
104
+
105
+ <div id="footer">
106
+ Generated on Tue Apr 15 02:47:42 2014 by
107
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
+ 0.8.7.4 (ruby-2.0.0).
109
+ </div>
110
+
111
+ </body>
112
+ </html>
@@ -42,6 +42,7 @@ module Tango
42
42
 
43
43
  # State wether model should be cached or not
44
44
  #
45
+ # @note If model is not persistent, model's table will be truncated
45
46
  # @return [Boolean]
46
47
  def self.persistent?
47
48
  raise NotImplementedError
data/lib/tango/app.rb CHANGED
@@ -2,8 +2,8 @@ require 'tango/version'
2
2
 
3
3
  module Tango
4
4
 
5
- # Interface for Tango app runtime filters
6
- #
5
+ # Tango application
6
+ #
7
7
  # @author Mckomo
8
8
  class App
9
9
 
@@ -39,12 +39,10 @@ module Tango
39
39
 
40
40
  # Filter run before Tango execution
41
41
  def before
42
- raise NotImplementedError
43
42
  end
44
43
 
45
44
  # Filter run after Tango execution
46
45
  def after
47
- raise NotImplementedError
48
46
  end
49
47
 
50
48
  # Register new resource model
@@ -136,13 +134,12 @@ module Tango
136
134
  next
137
135
  end
138
136
 
139
- # Use Nokogiri to parse response contents
137
+ # Parse response contents
140
138
  document = @parser.parse( response.body )
141
-
142
139
  # Init handler
143
140
  handler = handler_klass.new( link, document, @cache )
144
141
 
145
- # Append links fetched from hanlder
142
+ # Append links fetched from handler
146
143
  @link_stack.append( handler.links )
147
144
 
148
145
  # Try to fire the handler
@@ -1,21 +1,39 @@
1
1
  module Tango
2
2
 
3
+ # Database locker in form of .lock file
4
+ #
5
+ # @author Mckomo
3
6
  class DatabaseLocker
4
7
 
5
8
  attr_reader :lock_path
6
9
 
10
+
11
+ # Constructor of DatabaseLocker
7
12
  #
8
- #
13
+ # @param candidates [Array] List of databases to be blocked
14
+ # @param lock_path [String]
15
+ # @return [Tango::DatabaseLocker]
9
16
  def initialize( candidates = [], lock_path = "./tmp/database.lock" )
10
17
  @candidates = candidates
11
18
  @lock_path = lock_path
12
19
  end
13
20
 
14
- # Return next unlocked database
21
+ # Return name of unlocked database
22
+ #
23
+ # return [String]
15
24
  def unlocked
16
25
  @unlocked ||= find_unlocked
17
26
  end
18
27
 
28
+ # Lock given database
29
+ # @example
30
+ # unlocked = database_locker.unlocked # Find unlocked database
31
+ # connect_to_db( unlocked ) # Connect to unlocked database
32
+ # edit_db_data() # Change database data
33
+ # database_locker.lock( unlocked ) # Lock database to be sure that any changes wont be made
34
+ #
35
+ # @param database [String]
36
+ # @return [Tango::DatabaseLocker]
19
37
  def lock( database )
20
38
 
21
39
  @unlocked = nil
@@ -30,6 +48,9 @@ module Tango
30
48
 
31
49
  private
32
50
 
51
+ # Find unlocked database (with .lock file on mind)
52
+ #
53
+ # @return [String]
33
54
  def find_unlocked
34
55
 
35
56
  lock = File.open( lock_path, 'a+' ) { |f| f.read.strip.gsub(/\s+/, ' ') }
@@ -7,30 +7,36 @@ module Tango
7
7
  # @author Mckomo
8
8
  class HandlerInterface
9
9
 
10
+ attr_reader :url
11
+
10
12
  # Constructor of Tango's handler
11
13
  #
12
- #
13
- def initialize( link, document, cache = nil )
14
- @link = link
14
+ # @param url [String]
15
+ def initialize( url, document, cache = nil )
16
+ @url = url
15
17
  @document = document
16
18
  @cache = cache
17
19
  end
18
20
 
19
- #
21
+ # Return list of links to be crawled as next
20
22
  #
21
23
  # @return [Array|String]
22
24
  def links
23
25
  raise NotImplementedError
24
26
  end
25
27
 
26
- #
28
+ # Process document
27
29
  #
28
30
  # @return [NilClass]
29
31
  def trigger
30
32
  raise NotImplementedError
31
33
  end
32
34
 
33
- def self.applicable?( link )
35
+ # Wether handler should be applied for given url
36
+ #
37
+ # @param url [String]
38
+ # @return [Boolean]
39
+ def self.applicable?( url )
34
40
  raise NotImplementedError
35
41
  end
36
42
 
@@ -8,23 +8,23 @@ module Tango
8
8
 
9
9
  # Constructor of the Buffer
10
10
  #
11
- # @param size [Integer]
12
- # @return [Tango::Resources::Buffer]
11
+ # @param size [Integer]
12
+ # @return [Tango::Resource::Buffer]
13
13
  def initialize( size = 500 )
14
14
 
15
15
  # Set max size of the buffer
16
16
  @size = size
17
-
18
- # Init container for resources buffer
17
+
18
+ # Buffer storage for resources
19
19
  @resources = {}
20
- # Init container for resource operators classes
20
+ # Container of callbacks for each registered resource type
21
21
  @callbacks = {}
22
-
22
+
23
23
  end
24
24
 
25
25
  # Register new type of resource to be buffered
26
26
  #
27
- # @param type [Symbol]
27
+ # @param type [Symbol]
28
28
  # @param release_callback [Proc]
29
29
  def register( type, &release_callback )
30
30