resque-pool-dynamic 0.1.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.
@@ -0,0 +1,722 @@
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: Resque::Pool::Dynamic::Logfile
8
+
9
+ &mdash; Documentation by YARD 0.7.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '../../..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../../../_index.html">Index (L)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../../../Resque.html" title="Resque (module)">Resque</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Pool.html" title="Resque::Pool (class)">Pool</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Dynamic.html" title="Resque::Pool::Dynamic (class)">Dynamic</a></span></span>
38
+ &raquo;
39
+ <span class="title">Logfile</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Resque::Pool::Dynamic::Logfile
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName">IO::Tail::Logfile</span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">IO::Tail::Logfile</li>
75
+
76
+ <li class="next">Resque::Pool::Dynamic::Logfile</li>
77
+
78
+ </ul>
79
+ <a href="#" class="inheritanceTree">show all</a>
80
+
81
+ </dd>
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+ <dt class="r2 last">Defined in:</dt>
92
+ <dd class="r2 last">lib/resque/pool/dynamic/logfile.rb</dd>
93
+
94
+ </dl>
95
+ <div class="clear"></div>
96
+
97
+ <h2>Overview</h2><div class="docstring">
98
+ <div class="discussion">
99
+ <p>
100
+ Slightly customized tailable file class
101
+ </p>
102
+
103
+
104
+ </div>
105
+ </div>
106
+ <div class="tags">
107
+
108
+
109
+ </div>
110
+
111
+
112
+
113
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
114
+ <ul class="summary">
115
+
116
+ <li class="public ">
117
+ <span class="summary_signature">
118
+
119
+ <a href="#pid-instance_method" title="#pid (instance method)">- (Integer, NilClass) <strong>pid</strong> </a>
120
+
121
+
122
+
123
+ </span>
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ <span class="summary_desc"><div class='inline'><p>
136
+ PID of process that writes the log file.
137
+ </p>
138
+ </div></span>
139
+
140
+ </li>
141
+
142
+
143
+ </ul>
144
+
145
+
146
+
147
+
148
+
149
+ <h2>
150
+ Class Method Summary
151
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
152
+ </h2>
153
+
154
+ <ul class="summary">
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#open-class_method" title="open (class method)">+ (void) <strong>open</strong>(filename, opts = {}, &amp;block) </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <span class="summary_desc"><div class='inline'></div></span>
173
+
174
+ </li>
175
+
176
+
177
+ </ul>
178
+
179
+ <h2>
180
+ Instance Method Summary
181
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
182
+ </h2>
183
+
184
+ <ul class="summary">
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#alive%3F-instance_method" title="#alive? (instance method)">- (Boolean) <strong>alive?</strong> </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'><p>
203
+ True if child process is alive.
204
+ </p>
205
+ </div></span>
206
+
207
+ </li>
208
+
209
+
210
+ <li class="public ">
211
+ <span class="summary_signature">
212
+
213
+ <a href="#restat-instance_method" title="#restat (instance method)">- (void) <strong>restat</strong> </a>
214
+
215
+
216
+
217
+ </span>
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'><p>
227
+ Make sure to return on EOF if process is dead.
228
+ </p>
229
+ </div></span>
230
+
231
+ </li>
232
+
233
+
234
+ <li class="public ">
235
+ <span class="summary_signature">
236
+
237
+ <a href="#tail-instance_method" title="#tail (instance method)">- (void) <strong>tail</strong>(n = nil) {|ln| ... }</a>
238
+
239
+
240
+
241
+ </span>
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+ <span class="summary_desc"><div class='inline'><p>
251
+ Show last n lines of the file, or follow the file.
252
+ </p>
253
+ </div></span>
254
+
255
+ </li>
256
+
257
+
258
+ <li class="public ">
259
+ <span class="summary_signature">
260
+
261
+ <a href="#tail_to_eof-instance_method" title="#tail_to_eof (instance method)">- (void) <strong>tail_to_eof</strong> </a>
262
+
263
+
264
+
265
+ </span>
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+ <span class="summary_desc"><div class='inline'><p>
275
+ Print contents of the file until current end of file.
276
+ </p>
277
+ </div></span>
278
+
279
+ </li>
280
+
281
+
282
+ <li class="public ">
283
+ <span class="summary_signature">
284
+
285
+ <a href="#tail_until-instance_method" title="#tail_until (instance method)">- (void) <strong>tail_until</strong>(rx) </a>
286
+
287
+
288
+
289
+ </span>
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+ <span class="summary_desc"><div class='inline'><p>
299
+ Follow the file until a line matches regexp.
300
+ </p>
301
+ </div></span>
302
+
303
+ </li>
304
+
305
+
306
+ </ul>
307
+
308
+
309
+
310
+
311
+ <div id="instance_attr_details" class="attr_details">
312
+ <h2>Instance Attribute Details</h2>
313
+
314
+
315
+ <span id="pid=-instance_method"></span>
316
+ <span id="pid-instance_method"></span>
317
+ <div class="method_details first">
318
+ <p class="signature first" id="pid-instance_method">
319
+
320
+ - (<tt>Integer</tt>, <tt>NilClass</tt>) <strong>pid</strong>
321
+
322
+
323
+
324
+ </p><div class="docstring">
325
+ <div class="discussion">
326
+ <p>
327
+ PID of process that writes the log file
328
+ </p>
329
+
330
+
331
+ </div>
332
+ </div>
333
+ <div class="tags">
334
+
335
+ <h3>Returns:</h3>
336
+ <ul class="return">
337
+
338
+ <li>
339
+
340
+
341
+ <span class='type'>(<tt>Integer</tt>, <tt>NilClass</tt>)</span>
342
+
343
+
344
+
345
+ </li>
346
+
347
+ </ul>
348
+
349
+ </div><table class="source_code">
350
+ <tr>
351
+ <td>
352
+ <pre class="lines">
353
+
354
+
355
+ 32
356
+ 33
357
+ 34</pre>
358
+ </td>
359
+ <td>
360
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 32</span>
361
+
362
+ <span class='kw'>def</span> <span class='id identifier rubyid_pid'>pid</span>
363
+ <span class='ivar'>@pid</span>
364
+ <span class='kw'>end</span></pre>
365
+ </td>
366
+ </tr>
367
+ </table>
368
+ </div>
369
+
370
+ </div>
371
+
372
+
373
+ <div id="class_method_details" class="method_details_list">
374
+ <h2>Class Method Details</h2>
375
+
376
+
377
+ <div class="method_details first">
378
+ <p class="signature first" id="open-class_method">
379
+
380
+ + (<tt>void</tt>) <strong>open</strong>(filename, opts = {}, &amp;block)
381
+
382
+
383
+
384
+ </p><table class="source_code">
385
+ <tr>
386
+ <td>
387
+ <pre class="lines">
388
+
389
+
390
+ 34
391
+ 35
392
+ 36
393
+ 37</pre>
394
+ </td>
395
+ <td>
396
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 34</span>
397
+
398
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
399
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Need :pid</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</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'>:pid</span>
400
+ <span class='kw'>super</span>
401
+ <span class='kw'>end</span></pre>
402
+ </td>
403
+ </tr>
404
+ </table>
405
+ </div>
406
+
407
+ </div>
408
+
409
+ <div id="instance_method_details" class="method_details_list">
410
+ <h2>Instance Method Details</h2>
411
+
412
+
413
+ <div class="method_details first">
414
+ <p class="signature first" id="alive?-instance_method">
415
+
416
+ - (<tt>Boolean</tt>) <strong>alive?</strong>
417
+
418
+
419
+
420
+ </p><div class="docstring">
421
+ <div class="discussion">
422
+ <p>
423
+ True if child process is alive
424
+ </p>
425
+
426
+
427
+ </div>
428
+ </div>
429
+ <div class="tags">
430
+
431
+ <h3>Returns:</h3>
432
+ <ul class="return">
433
+
434
+ <li>
435
+
436
+
437
+ <span class='type'>(<tt>Boolean</tt>)</span>
438
+
439
+
440
+
441
+ </li>
442
+
443
+ </ul>
444
+
445
+ </div><table class="source_code">
446
+ <tr>
447
+ <td>
448
+ <pre class="lines">
449
+
450
+
451
+ 40
452
+ 41
453
+ 42</pre>
454
+ </td>
455
+ <td>
456
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 40</span>
457
+
458
+ <span class='kw'>def</span> <span class='id identifier rubyid_alive?'>alive?</span>
459
+ <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_getpgid'>getpgid</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
460
+ <span class='kw'>end</span></pre>
461
+ </td>
462
+ </tr>
463
+ </table>
464
+ </div>
465
+
466
+ <div class="method_details ">
467
+ <p class="signature " id="restat-instance_method">
468
+
469
+ - (<tt>void</tt>) <strong>restat</strong>
470
+
471
+
472
+
473
+ </p><div class="docstring">
474
+ <div class="discussion">
475
+ <p>
476
+ Make sure to return on EOF if process is dead
477
+ </p>
478
+
479
+
480
+ </div>
481
+ </div>
482
+ <div class="tags">
483
+
484
+
485
+ </div><table class="source_code">
486
+ <tr>
487
+ <td>
488
+ <pre class="lines">
489
+
490
+
491
+ 45
492
+ 46
493
+ 47
494
+ 48</pre>
495
+ </td>
496
+ <td>
497
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 45</span>
498
+
499
+ <span class='kw'>def</span> <span class='id identifier rubyid_restat'>restat</span>
500
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_return_if_eof'>return_if_eof</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_alive?'>alive?</span>
501
+ <span class='kw'>super</span>
502
+ <span class='kw'>end</span></pre>
503
+ </td>
504
+ </tr>
505
+ </table>
506
+ </div>
507
+
508
+ <div class="method_details ">
509
+ <p class="signature " id="tail-instance_method">
510
+
511
+ - (<tt>void</tt>) <strong>tail</strong>(n = nil) {|ln| ... }
512
+
513
+
514
+
515
+ </p><div class="docstring">
516
+ <div class="discussion">
517
+ <p>
518
+ Show last n lines of the file, or follow the file
519
+ </p>
520
+
521
+
522
+ </div>
523
+ </div>
524
+ <div class="tags">
525
+ <h3>Parameters:</h3>
526
+ <ul class="param">
527
+
528
+ <li>
529
+
530
+ <span class='name'>n</span>
531
+
532
+
533
+ <span class='type'>(<tt>Integer</tt>, <tt>NilClass</tt>)</span>
534
+
535
+
536
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
537
+
538
+
539
+ &mdash;
540
+ <div class='inline'><p>
541
+ Number of lines or nil
542
+ </p>
543
+ </div>
544
+
545
+ </li>
546
+
547
+ </ul>
548
+
549
+ <h3>Yields:</h3>
550
+ <ul class="yield">
551
+
552
+ <li>
553
+
554
+
555
+ <span class='type'>(<tt>ln</tt>)</span>
556
+
557
+
558
+
559
+ &mdash;
560
+ <div class='inline'><p>
561
+ Called for every line of file
562
+ </p>
563
+ </div>
564
+
565
+ </li>
566
+
567
+ </ul>
568
+ <h3>Yield Parameters:</h3>
569
+ <ul class="yieldparam">
570
+
571
+ <li>
572
+
573
+ <span class='name'>ln</span>
574
+
575
+
576
+ <span class='type'>(<tt>String</tt>)</span>
577
+
578
+
579
+
580
+ &mdash;
581
+ <div class='inline'><p>
582
+ Input line
583
+ </p>
584
+ </div>
585
+
586
+ </li>
587
+
588
+ </ul>
589
+
590
+ </div><table class="source_code">
591
+ <tr>
592
+ <td>
593
+ <pre class="lines">
594
+
595
+
596
+ 55
597
+ 56
598
+ 57
599
+ 58
600
+ 59
601
+ 60
602
+ 61
603
+ 62</pre>
604
+ </td>
605
+ <td>
606
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 55</span>
607
+
608
+ <span class='kw'>def</span> <span class='id identifier rubyid_tail'>tail</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
609
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ln'>ln</span><span class='op'>|</span>
610
+ <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_ln'>ln</span>
611
+ <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_ln'>ln</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
612
+ <span class='kw'>end</span>
613
+ <span class='kw'>rescue</span> <span class='const'>Interrupt</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
614
+ <span class='kw'>nil</span>
615
+ <span class='kw'>end</span></pre>
616
+ </td>
617
+ </tr>
618
+ </table>
619
+ </div>
620
+
621
+ <div class="method_details ">
622
+ <p class="signature " id="tail_to_eof-instance_method">
623
+
624
+ - (<tt>void</tt>) <strong>tail_to_eof</strong>
625
+
626
+
627
+
628
+ </p><div class="docstring">
629
+ <div class="discussion">
630
+ <p>
631
+ Print contents of the file until current end of file
632
+ </p>
633
+
634
+
635
+ </div>
636
+ </div>
637
+ <div class="tags">
638
+
639
+
640
+ </div><table class="source_code">
641
+ <tr>
642
+ <td>
643
+ <pre class="lines">
644
+
645
+
646
+ 74
647
+ 75
648
+ 76
649
+ 77
650
+ 78
651
+ 79</pre>
652
+ </td>
653
+ <td>
654
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 74</span>
655
+
656
+ <span class='kw'>def</span> <span class='id identifier rubyid_tail_to_eof'>tail_to_eof</span>
657
+ <span class='id identifier rubyid_orig_return_if_eof'>orig_return_if_eof</span><span class='comma'>,</span> <span class='id identifier rubyid_return_if_eof'>return_if_eof</span> <span class='op'>=</span> <span class='id identifier rubyid_return_if_eof'>return_if_eof</span><span class='comma'>,</span> <span class='kw'>true</span>
658
+ <span class='id identifier rubyid_tail'>tail</span>
659
+ <span class='kw'>ensure</span>
660
+ <span class='id identifier rubyid_return_if_eof'>return_if_eof</span> <span class='op'>=</span> <span class='id identifier rubyid_orig_return_if_eof'>orig_return_if_eof</span>
661
+ <span class='kw'>end</span></pre>
662
+ </td>
663
+ </tr>
664
+ </table>
665
+ </div>
666
+
667
+ <div class="method_details ">
668
+ <p class="signature " id="tail_until-instance_method">
669
+
670
+ - (<tt>void</tt>) <strong>tail_until</strong>(rx)
671
+
672
+
673
+
674
+ </p><div class="docstring">
675
+ <div class="discussion">
676
+ <p>
677
+ Follow the file until a line matches regexp
678
+ </p>
679
+
680
+
681
+ </div>
682
+ </div>
683
+ <div class="tags">
684
+
685
+
686
+ </div><table class="source_code">
687
+ <tr>
688
+ <td>
689
+ <pre class="lines">
690
+
691
+
692
+ 66
693
+ 67
694
+ 68
695
+ 69
696
+ 70</pre>
697
+ </td>
698
+ <td>
699
+ <pre class="code"><span class="info file"># File 'lib/resque/pool/dynamic/logfile.rb', line 66</span>
700
+
701
+ <span class='kw'>def</span> <span class='id identifier rubyid_tail_until'>tail_until</span><span class='lparen'>(</span><span class='id identifier rubyid_rx'>rx</span><span class='rparen'>)</span>
702
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tail'>tail</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ln'>ln</span><span class='op'>|</span>
703
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>IO</span><span class='op'>::</span><span class='const'>Tail</span><span class='op'>::</span><span class='const'>ReturnException</span> <span class='kw'>if</span> <span class='id identifier rubyid_ln'>ln</span> <span class='op'>=~</span> <span class='id identifier rubyid_rx'>rx</span>
704
+ <span class='kw'>end</span>
705
+ <span class='kw'>end</span></pre>
706
+ </td>
707
+ </tr>
708
+ </table>
709
+ </div>
710
+
711
+ </div>
712
+
713
+ </div>
714
+
715
+ <div id="footer">
716
+ Generated on Wed Apr 25 21:03:03 2012 by
717
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
718
+ 0.7.5 (ruby-1.9.2).
719
+ </div>
720
+
721
+ </body>
722
+ </html>