dh_easy-test 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +7 -0
  4. data/.yardopts +1 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE +21 -0
  8. data/README.md +20 -0
  9. data/Rakefile +22 -0
  10. data/dh_easy-test.gemspec +49 -0
  11. data/doc/DhEasy.html +117 -0
  12. data/doc/DhEasy/Core.html +117 -0
  13. data/doc/DhEasy/Core/Mock.html +115 -0
  14. data/doc/DhEasy/Core/Mock/FakeExecutor.html +2114 -0
  15. data/doc/DhEasy/Core/Modk.html +105 -0
  16. data/doc/DhEasy/Core/Plugin.html +117 -0
  17. data/doc/DhEasy/Core/Plugin/ExecutorBehavior.html +196 -0
  18. data/doc/DhEasy/Test.html +616 -0
  19. data/doc/DhEasy/Test/Helper.html +1710 -0
  20. data/doc/DhEasy/Test/RecordTask.html +2493 -0
  21. data/doc/_index.html +237 -0
  22. data/doc/class_list.html +51 -0
  23. data/doc/css/common.css +1 -0
  24. data/doc/css/full_list.css +58 -0
  25. data/doc/css/style.css +496 -0
  26. data/doc/file.README.html +91 -0
  27. data/doc/file_list.html +56 -0
  28. data/doc/frames.html +17 -0
  29. data/doc/index.html +91 -0
  30. data/doc/js/app.js +303 -0
  31. data/doc/js/full_list.js +216 -0
  32. data/doc/js/jquery.js +4 -0
  33. data/doc/method_list.html +427 -0
  34. data/doc/top-level-namespace.html +110 -0
  35. data/lib/dh_easy/test.rb +52 -0
  36. data/lib/dh_easy/test/helper.rb +225 -0
  37. data/lib/dh_easy/test/rake.rb +335 -0
  38. data/lib/dh_easy/test/version.rb +6 -0
  39. data/lib/dh_easy_override/core.rb +7 -0
  40. data/lib/dh_easy_override/core/mock.rb +8 -0
  41. data/lib/dh_easy_override/core/mock/fake_executor.rb +338 -0
  42. data/lib/dh_easy_override/core/plugin.rb +8 -0
  43. data/lib/dh_easy_override/core/plugin/executor_behavior.rb +11 -0
  44. metadata +200 -0
@@ -0,0 +1,2493 @@
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: DhEasy::Test::RecordTask
8
+
9
+ &mdash; 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 = "DhEasy::Test::RecordTask";
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 (R)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Test.html" title="DhEasy::Test (module)">Test</a></span></span>
41
+ &raquo;
42
+ <span class="title">RecordTask</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: DhEasy::Test::RecordTask
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">DhEasy::Test::RecordTask</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/dh_easy/test/rake.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Record rake task generator. It allows Datahen pages snapshots to be</p>
106
+
107
+ <pre class="code ruby"><code class="ruby">recorded for an easy way to perform integration tests.
108
+ </code></pre>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ </div>
117
+
118
+
119
+
120
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
121
+ <ul class="summary">
122
+
123
+ <li class="public ">
124
+ <span class="summary_signature">
125
+
126
+ <a href="#scraper_name-instance_method" title="#scraper_name (instance method)">#<strong>scraper_name</strong> &#x21d2; String<sup>?</sup> </a>
127
+
128
+
129
+
130
+ </span>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <span class="summary_desc"><div class='inline'>
144
+ <p>Scraper name to be used to get job_id.</p>
145
+ </div></span>
146
+
147
+ </li>
148
+
149
+
150
+ </ul>
151
+
152
+
153
+
154
+
155
+
156
+ <h2>
157
+ Instance Method Summary
158
+ <small><a href="#" class="summary_toggle">collapse</a></small>
159
+ </h2>
160
+
161
+ <ul class="summary">
162
+
163
+ <li class="public ">
164
+ <span class="summary_signature">
165
+
166
+ <a href="#create_task-instance_method" title="#create_task (instance method)">#<strong>create_task</strong> &#x21d2; Object </a>
167
+
168
+
169
+
170
+ </span>
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"><div class='inline'>
181
+ <p>Create the record rake task.</p>
182
+ </div></span>
183
+
184
+ </li>
185
+
186
+
187
+ <li class="public ">
188
+ <span class="summary_signature">
189
+
190
+ <a href="#disable_verbose-instance_method" title="#disable_verbose (instance method)">#<strong>disable_verbose</strong> &#x21d2; Object </a>
191
+
192
+
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="summary_desc"><div class='inline'>
205
+ <p>Disable verbose.</p>
206
+ </div></span>
207
+
208
+ </li>
209
+
210
+
211
+ <li class="public ">
212
+ <span class="summary_signature">
213
+
214
+ <a href="#enable_verbose-instance_method" title="#enable_verbose (instance method)">#<strong>enable_verbose</strong> &#x21d2; Object </a>
215
+
216
+
217
+
218
+ </span>
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+ <span class="summary_desc"><div class='inline'>
229
+ <p>Enable verbose.</p>
230
+ </div></span>
231
+
232
+ </li>
233
+
234
+
235
+ <li class="public ">
236
+ <span class="summary_signature">
237
+
238
+ <a href="#ensure_job_id-instance_method" title="#ensure_job_id (instance method)">#<strong>ensure_job_id</strong> &#x21d2; Integer<sup>?</sup> </a>
239
+
240
+
241
+
242
+ </span>
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <span class="summary_desc"><div class='inline'>
253
+ <p>Ensures that job_id exists.</p>
254
+ </div></span>
255
+
256
+ </li>
257
+
258
+
259
+ <li class="public ">
260
+ <span class="summary_signature">
261
+
262
+ <a href="#executor-instance_method" title="#executor (instance method)">#<strong>executor</strong> &#x21d2; Datahen::Scraper::Executor </a>
263
+
264
+
265
+
266
+ </span>
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+ <span class="summary_desc"><div class='inline'>
277
+ <p>Datahen executor used to get the data to be recorded.</p>
278
+ </div></span>
279
+
280
+ </li>
281
+
282
+
283
+ <li class="public ">
284
+ <span class="summary_signature">
285
+
286
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> {|task| ... } &#x21d2; RecordTask </a>
287
+
288
+
289
+
290
+ </span>
291
+
292
+
293
+ <span class="note title constructor">constructor</span>
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'>
303
+ <p>Initialize record task.</p>
304
+ </div></span>
305
+
306
+ </li>
307
+
308
+
309
+ <li class="public ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#input_map-instance_method" title="#input_map (instance method)">#<strong>input_map</strong> &#x21d2; Array </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+ <span class="summary_desc"><div class='inline'>
327
+ <p>An array of input maps to configure what gid record will be saved into
328
+ each directory.</p>
329
+ </div></span>
330
+
331
+ </li>
332
+
333
+
334
+ <li class="public ">
335
+ <span class="summary_signature">
336
+
337
+ <a href="#job_id-instance_method" title="#job_id (instance method)">#<strong>job_id</strong> &#x21d2; Integer<sup>?</sup> </a>
338
+
339
+
340
+
341
+ </span>
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+ <span class="summary_desc"><div class='inline'>
352
+ <p>Job id to be used on page recording.</p>
353
+ </div></span>
354
+
355
+ </li>
356
+
357
+
358
+ <li class="public ">
359
+ <span class="summary_signature">
360
+
361
+ <a href="#job_id=-instance_method" title="#job_id= (instance method)">#<strong>job_id=</strong>(value) &#x21d2; Object </a>
362
+
363
+
364
+
365
+ </span>
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+ <span class="summary_desc"><div class='inline'>
376
+ <p>Set job id.</p>
377
+ </div></span>
378
+
379
+ </li>
380
+
381
+
382
+ <li class="public ">
383
+ <span class="summary_signature">
384
+
385
+ <a href="#log-instance_method" title="#log (instance method)">#<strong>log</strong>(text) &#x21d2; Object </a>
386
+
387
+
388
+
389
+ </span>
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+ <span class="summary_desc"><div class='inline'>
400
+ <p>Log text into stdout when verbose is enabled (see #verbose?).</p>
401
+ </div></span>
402
+
403
+ </li>
404
+
405
+
406
+ <li class="public ">
407
+ <span class="summary_signature">
408
+
409
+ <a href="#record-instance_method" title="#record (instance method)">#<strong>record</strong>(map) &#x21d2; Object </a>
410
+
411
+
412
+
413
+ </span>
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+ <span class="summary_desc"><div class='inline'>
424
+ <p>Record a page data into a specific directory.</p>
425
+ </div></span>
426
+
427
+ </li>
428
+
429
+
430
+ <li class="public ">
431
+ <span class="summary_signature">
432
+
433
+ <a href="#record_content-instance_method" title="#record_content (instance method)">#<strong>record_content</strong>(gid, dir) &#x21d2; Object </a>
434
+
435
+
436
+
437
+ </span>
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+ <span class="summary_desc"><div class='inline'>
448
+ <p>Record a page raw content (HTML, XML, excel, zip, etc.) into `content`
449
+ file within the provided directory.</p>
450
+ </div></span>
451
+
452
+ </li>
453
+
454
+
455
+ <li class="public ">
456
+ <span class="summary_signature">
457
+
458
+ <a href="#record_failed_content-instance_method" title="#record_failed_content (instance method)">#<strong>record_failed_content</strong>(gid, dir) &#x21d2; Object </a>
459
+
460
+
461
+
462
+ </span>
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+ <span class="summary_desc"><div class='inline'>
473
+ <p>Record a page raw failed content (HTML, XML, excel, zip, etc.) into
474
+ `failed_content` file within the provided directory.</p>
475
+ </div></span>
476
+
477
+ </li>
478
+
479
+
480
+ <li class="public ">
481
+ <span class="summary_signature">
482
+
483
+ <a href="#record_file-instance_method" title="#record_file (instance method)">#<strong>record_file</strong>(path, content) {|file| ... } &#x21d2; Object </a>
484
+
485
+
486
+
487
+ </span>
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+ <span class="summary_desc"><div class='inline'>
498
+ <p>Record a content into a file only when the content is not null.</p>
499
+ </div></span>
500
+
501
+ </li>
502
+
503
+
504
+ <li class="public ">
505
+ <span class="summary_signature">
506
+
507
+ <a href="#record_outputs-instance_method" title="#record_outputs (instance method)">#<strong>record_outputs</strong>(filter = nil) &#x21d2; Object </a>
508
+
509
+
510
+
511
+ </span>
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+ <span class="summary_desc"><div class='inline'>
522
+ <p>Record a collection of outputs (JSON) into `outputs.json` file within the
523
+ provided directory using filters on Datahen executor `find_outputs`
524
+ method to retrieve all matching outputs regardless of pagination.</p>
525
+ </div></span>
526
+
527
+ </li>
528
+
529
+
530
+ <li class="public ">
531
+ <span class="summary_signature">
532
+
533
+ <a href="#record_page-instance_method" title="#record_page (instance method)">#<strong>record_page</strong>(gid, dir) &#x21d2; Object </a>
534
+
535
+
536
+
537
+ </span>
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+ <span class="summary_desc"><div class='inline'>
548
+ <p>Record a page&#39;s global or job definition (JSON) into `page.json` file
549
+ within the provided directory.</p>
550
+ </div></span>
551
+
552
+ </li>
553
+
554
+
555
+ <li class="public ">
556
+ <span class="summary_signature">
557
+
558
+ <a href="#record_pages-instance_method" title="#record_pages (instance method)">#<strong>record_pages</strong>(input_map) &#x21d2; Object </a>
559
+
560
+
561
+
562
+ </span>
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+ <span class="summary_desc"><div class='inline'>
573
+ <p>Record pages from an input map collection.</p>
574
+ </div></span>
575
+
576
+ </li>
577
+
578
+
579
+ <li class="public ">
580
+ <span class="summary_signature">
581
+
582
+ <a href="#record_vars-instance_method" title="#record_vars (instance method)">#<strong>record_vars</strong>(gid, dir) &#x21d2; Object </a>
583
+
584
+
585
+
586
+ </span>
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+ <span class="summary_desc"><div class='inline'>
597
+ <p>Record a page&#39;s vars from job page definition (JSON) into `vars.json`
598
+ file within the provided directory.</p>
599
+ </div></span>
600
+
601
+ </li>
602
+
603
+
604
+ <li class="public ">
605
+ <span class="summary_signature">
606
+
607
+ <a href="#root_dir-instance_method" title="#root_dir (instance method)">#<strong>root_dir</strong> &#x21d2; String<sup>?</sup> </a>
608
+
609
+
610
+
611
+ </span>
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+ <span class="summary_desc"><div class='inline'>
622
+ <p>Root directory to record pages.</p>
623
+ </div></span>
624
+
625
+ </li>
626
+
627
+
628
+ <li class="public ">
629
+ <span class="summary_signature">
630
+
631
+ <a href="#verbose%3F-instance_method" title="#verbose? (instance method)">#<strong>verbose?</strong> &#x21d2; Boolean </a>
632
+
633
+
634
+
635
+ </span>
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+ <span class="summary_desc"><div class='inline'>
646
+ <p>Will show logs on stdout when enabled (see #enable_verbose and
647
+ #disable_verbose).</p>
648
+ </div></span>
649
+
650
+ </li>
651
+
652
+
653
+ </ul>
654
+
655
+
656
+ <div id="constructor_details" class="method_details_list">
657
+ <h2>Constructor Details</h2>
658
+
659
+ <div class="method_details first">
660
+ <h3 class="signature first" id="initialize-instance_method">
661
+
662
+ #<strong>initialize</strong> {|task| ... } &#x21d2; <tt><span class='object_link'><a href="" title="DhEasy::Test::RecordTask (class)">RecordTask</a></span></tt>
663
+
664
+
665
+
666
+
667
+
668
+ </h3><div class="docstring">
669
+ <div class="discussion">
670
+
671
+ <p>Initialize record task. Use block to configure record task.</p>
672
+
673
+
674
+ </div>
675
+ </div>
676
+ <div class="tags">
677
+
678
+ <p class="tag_title">Yield Parameters:</p>
679
+ <ul class="yieldparam">
680
+
681
+ <li>
682
+
683
+ <span class='name'>task</span>
684
+
685
+
686
+ <span class='type'>(<tt><span class='object_link'><a href="" title="DhEasy::Test::RecordTask (class)">DhEasy::Test::RecordTask</a></span></tt>)</span>
687
+
688
+
689
+
690
+ &mdash;
691
+ <div class='inline'>
692
+ <p>Self.</p>
693
+ </div>
694
+
695
+ </li>
696
+
697
+ </ul>
698
+
699
+ </div><table class="source_code">
700
+ <tr>
701
+ <td>
702
+ <pre class="lines">
703
+
704
+
705
+ 328
706
+ 329
707
+ 330
708
+ 331
709
+ 332</pre>
710
+ </td>
711
+ <td>
712
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 328</span>
713
+
714
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
715
+ <span class='id identifier rubyid_verbose'>verbose</span> <span class='op'>=</span> <span class='kw'>nil</span>
716
+ <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='kw'>self</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
717
+ <span class='id identifier rubyid_create_task'>create_task</span>
718
+ <span class='kw'>end</span></pre>
719
+ </td>
720
+ </tr>
721
+ </table>
722
+ </div>
723
+
724
+ </div>
725
+
726
+ <div id="instance_attr_details" class="attr_details">
727
+ <h2>Instance Attribute Details</h2>
728
+
729
+
730
+ <span id="scraper_name=-instance_method"></span>
731
+ <div class="method_details first">
732
+ <h3 class="signature first" id="scraper_name-instance_method">
733
+
734
+ #<strong>scraper_name</strong> &#x21d2; <tt>String</tt><sup>?</sup>
735
+
736
+
737
+
738
+
739
+
740
+ </h3><div class="docstring">
741
+ <div class="discussion">
742
+
743
+ <p>Scraper name to be used to get job_id.</p>
744
+
745
+
746
+ </div>
747
+ </div>
748
+ <div class="tags">
749
+
750
+ <p class="tag_title">Returns:</p>
751
+ <ul class="return">
752
+
753
+ <li>
754
+
755
+
756
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
757
+
758
+
759
+
760
+ </li>
761
+
762
+ </ul>
763
+
764
+ </div><table class="source_code">
765
+ <tr>
766
+ <td>
767
+ <pre class="lines">
768
+
769
+
770
+ 11
771
+ 12
772
+ 13</pre>
773
+ </td>
774
+ <td>
775
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 11</span>
776
+
777
+ <span class='kw'>def</span> <span class='id identifier rubyid_scraper_name'>scraper_name</span>
778
+ <span class='ivar'>@scraper_name</span>
779
+ <span class='kw'>end</span></pre>
780
+ </td>
781
+ </tr>
782
+ </table>
783
+ </div>
784
+
785
+ </div>
786
+
787
+
788
+ <div id="instance_method_details" class="method_details_list">
789
+ <h2>Instance Method Details</h2>
790
+
791
+
792
+ <div class="method_details first">
793
+ <h3 class="signature first" id="create_task-instance_method">
794
+
795
+ #<strong>create_task</strong> &#x21d2; <tt>Object</tt>
796
+
797
+
798
+
799
+
800
+
801
+ </h3><div class="docstring">
802
+ <div class="discussion">
803
+
804
+ <p>Create the record rake task</p>
805
+
806
+
807
+ </div>
808
+ </div>
809
+ <div class="tags">
810
+
811
+
812
+ </div><table class="source_code">
813
+ <tr>
814
+ <td>
815
+ <pre class="lines">
816
+
817
+
818
+ 316
819
+ 317
820
+ 318
821
+ 319
822
+ 320
823
+ 321
824
+ 322
825
+ 323</pre>
826
+ </td>
827
+ <td>
828
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 316</span>
829
+
830
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_task'>create_task</span>
831
+ <span class='id identifier rubyid_namespace'>namespace</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>dh_easy</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>do</span>
832
+ <span class='id identifier rubyid_desc'>desc</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Generates input files by gid into the configured directories, use these on context loading.</span><span class='tstring_end'>&quot;</span></span>
833
+ <span class='id identifier rubyid_task'>task</span> <span class='symbol'>:record_pages</span> <span class='kw'>do</span>
834
+ <span class='id identifier rubyid_record_pages'>record_pages</span> <span class='id identifier rubyid_input_map'>input_map</span>
835
+ <span class='kw'>end</span>
836
+ <span class='kw'>end</span>
837
+ <span class='kw'>end</span></pre>
838
+ </td>
839
+ </tr>
840
+ </table>
841
+ </div>
842
+
843
+ <div class="method_details ">
844
+ <h3 class="signature " id="disable_verbose-instance_method">
845
+
846
+ #<strong>disable_verbose</strong> &#x21d2; <tt>Object</tt>
847
+
848
+
849
+
850
+
851
+
852
+ </h3><div class="docstring">
853
+ <div class="discussion">
854
+
855
+ <p>Disable verbose.</p>
856
+
857
+
858
+ </div>
859
+ </div>
860
+ <div class="tags">
861
+
862
+
863
+ </div><table class="source_code">
864
+ <tr>
865
+ <td>
866
+ <pre class="lines">
867
+
868
+
869
+ 30
870
+ 31
871
+ 32</pre>
872
+ </td>
873
+ <td>
874
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 30</span>
875
+
876
+ <span class='kw'>def</span> <span class='id identifier rubyid_disable_verbose'>disable_verbose</span>
877
+ <span class='ivar'>@verbose</span> <span class='op'>=</span> <span class='kw'>false</span>
878
+ <span class='kw'>end</span></pre>
879
+ </td>
880
+ </tr>
881
+ </table>
882
+ </div>
883
+
884
+ <div class="method_details ">
885
+ <h3 class="signature " id="enable_verbose-instance_method">
886
+
887
+ #<strong>enable_verbose</strong> &#x21d2; <tt>Object</tt>
888
+
889
+
890
+
891
+
892
+
893
+ </h3><div class="docstring">
894
+ <div class="discussion">
895
+
896
+ <p>Enable verbose.</p>
897
+
898
+
899
+ </div>
900
+ </div>
901
+ <div class="tags">
902
+
903
+
904
+ </div><table class="source_code">
905
+ <tr>
906
+ <td>
907
+ <pre class="lines">
908
+
909
+
910
+ 25
911
+ 26
912
+ 27</pre>
913
+ </td>
914
+ <td>
915
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 25</span>
916
+
917
+ <span class='kw'>def</span> <span class='id identifier rubyid_enable_verbose'>enable_verbose</span>
918
+ <span class='ivar'>@verbose</span> <span class='op'>=</span> <span class='kw'>true</span>
919
+ <span class='kw'>end</span></pre>
920
+ </td>
921
+ </tr>
922
+ </table>
923
+ </div>
924
+
925
+ <div class="method_details ">
926
+ <h3 class="signature " id="ensure_job_id-instance_method">
927
+
928
+ #<strong>ensure_job_id</strong> &#x21d2; <tt>Integer</tt><sup>?</sup>
929
+
930
+
931
+
932
+
933
+
934
+ </h3><div class="docstring">
935
+ <div class="discussion">
936
+
937
+ <p>Ensures that job_id exists. If #scraper_name is present and no #job_id</p>
938
+
939
+ <pre class="code ruby"><code class="ruby">was specified, then it will get the latest `job_id` for the
940
+ `scraper_name` provided.
941
+ </code></pre>
942
+
943
+
944
+ </div>
945
+ </div>
946
+ <div class="tags">
947
+
948
+ <p class="tag_title">Returns:</p>
949
+ <ul class="return">
950
+
951
+ <li>
952
+
953
+
954
+ <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
955
+
956
+
957
+
958
+ &mdash;
959
+ <div class='inline'>
960
+ <p>Job id.</p>
961
+ </div>
962
+
963
+ </li>
964
+
965
+ </ul>
966
+
967
+ </div><table class="source_code">
968
+ <tr>
969
+ <td>
970
+ <pre class="lines">
971
+
972
+
973
+ 102
974
+ 103
975
+ 104
976
+ 105
977
+ 106
978
+ 107
979
+ 108
980
+ 109</pre>
981
+ </td>
982
+ <td>
983
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 102</span>
984
+
985
+ <span class='kw'>def</span> <span class='id identifier rubyid_ensure_job_id'>ensure_job_id</span>
986
+ <span class='kw'>if</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='period'>.</span><span class='id identifier rubyid_nil'>nil</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_scraper_name'>scraper_name</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
987
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Retriving \&quot;job_id\&quot; from scraper \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scraper_name'>scraper_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span>
988
+ <span class='id identifier rubyid_job_id'>job_id</span> <span class='op'>=</span> <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_get_job_id'>get_job_id</span> <span class='id identifier rubyid_scraper_name'>scraper_name</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
989
+ <span class='kw'>end</span>
990
+ <span class='id identifier rubyid_log'>log</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>No &quot;job_id&quot; was specified.</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Using \&quot;job_id\&quot; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_job_id'>job_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
991
+ <span class='id identifier rubyid_job_id'>job_id</span>
992
+ <span class='kw'>end</span></pre>
993
+ </td>
994
+ </tr>
995
+ </table>
996
+ </div>
997
+
998
+ <div class="method_details ">
999
+ <h3 class="signature " id="executor-instance_method">
1000
+
1001
+ #<strong>executor</strong> &#x21d2; <tt>Datahen::Scraper::Executor</tt>
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+ </h3><div class="docstring">
1008
+ <div class="discussion">
1009
+
1010
+ <p>Datahen executor used to get the data to be recorded.</p>
1011
+
1012
+
1013
+ </div>
1014
+ </div>
1015
+ <div class="tags">
1016
+
1017
+ <p class="tag_title">Returns:</p>
1018
+ <ul class="return">
1019
+
1020
+ <li>
1021
+
1022
+
1023
+ <span class='type'>(<tt>Datahen::Scraper::Executor</tt>)</span>
1024
+
1025
+
1026
+
1027
+ </li>
1028
+
1029
+ </ul>
1030
+
1031
+ </div><table class="source_code">
1032
+ <tr>
1033
+ <td>
1034
+ <pre class="lines">
1035
+
1036
+
1037
+ 93
1038
+ 94
1039
+ 95</pre>
1040
+ </td>
1041
+ <td>
1042
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 93</span>
1043
+
1044
+ <span class='kw'>def</span> <span class='id identifier rubyid_executor'>executor</span>
1045
+ <span class='ivar'>@executor</span> <span class='op'>||=</span> <span class='const'>Datahen</span><span class='op'>::</span><span class='const'>Scraper</span><span class='op'>::</span><span class='const'>Executor</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</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="input_map-instance_method">
1054
+
1055
+ #<strong>input_map</strong> &#x21d2; <tt>Array</tt>
1056
+
1057
+
1058
+
1059
+
1060
+
1061
+ </h3><div class="docstring">
1062
+ <div class="discussion">
1063
+
1064
+ <p>An array of input maps to configure what gid record will be saved into</p>
1065
+
1066
+ <pre class="code ruby"><code class="ruby">each directory. It uses absolute paths when #root_dir is nil, and
1067
+ relative paths when it has been assigned.
1068
+ </code></pre>
1069
+
1070
+
1071
+ </div>
1072
+ </div>
1073
+ <div class="tags">
1074
+
1075
+ <p class="tag_title">Returns:</p>
1076
+ <ul class="return">
1077
+
1078
+ <li>
1079
+
1080
+
1081
+ <span class='type'>(<tt>Array</tt>)</span>
1082
+
1083
+
1084
+
1085
+ &mdash;
1086
+ <div class='inline'>
1087
+ <p>Map structure is as follows (see #record_outputs for details about `<a
1088
+ href=":filter">input_map[]</a>[:outputs]` options): “` [</p>
1089
+
1090
+ <pre class="code ruby"><code class="ruby">{
1091
+ gid:&#39;my-gid-123abc&#39;,
1092
+ dir:&#39;/path/to/input/directory&#39;,
1093
+ record_content: true/false, # Default: true
1094
+ record_failed_content: true/false, # Default: true,
1095
+ record_page: true/false, # Default: true
1096
+ record_vars: true/false, # Default: false
1097
+ filters: {
1098
+ outputs: {
1099
+ # Output filters
1100
+ }
1101
+ }
1102
+ }, {
1103
+ # ...
1104
+ }
1105
+ </code></pre>
1106
+
1107
+ <p>]</p>
1108
+ </div>
1109
+
1110
+ </li>
1111
+
1112
+ </ul>
1113
+
1114
+ </div><table class="source_code">
1115
+ <tr>
1116
+ <td>
1117
+ <pre class="lines">
1118
+
1119
+
1120
+ 86
1121
+ 87
1122
+ 88</pre>
1123
+ </td>
1124
+ <td>
1125
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 86</span>
1126
+
1127
+ <span class='kw'>def</span> <span class='id identifier rubyid_input_map'>input_map</span>
1128
+ <span class='ivar'>@input_map</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1129
+ <span class='kw'>end</span></pre>
1130
+ </td>
1131
+ </tr>
1132
+ </table>
1133
+ </div>
1134
+
1135
+ <div class="method_details ">
1136
+ <h3 class="signature " id="job_id-instance_method">
1137
+
1138
+ #<strong>job_id</strong> &#x21d2; <tt>Integer</tt><sup>?</sup>
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+ </h3><div class="docstring">
1145
+ <div class="discussion">
1146
+
1147
+ <p>Job id to be used on page recording.</p>
1148
+
1149
+
1150
+ </div>
1151
+ </div>
1152
+ <div class="tags">
1153
+
1154
+ <p class="tag_title">Returns:</p>
1155
+ <ul class="return">
1156
+
1157
+ <li>
1158
+
1159
+
1160
+ <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
1161
+
1162
+
1163
+
1164
+ </li>
1165
+
1166
+ </ul>
1167
+
1168
+ </div><table class="source_code">
1169
+ <tr>
1170
+ <td>
1171
+ <pre class="lines">
1172
+
1173
+
1174
+ 37
1175
+ 38
1176
+ 39</pre>
1177
+ </td>
1178
+ <td>
1179
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 37</span>
1180
+
1181
+ <span class='kw'>def</span> <span class='id identifier rubyid_job_id'>job_id</span>
1182
+ <span class='ivar'>@job_id</span> <span class='op'>||=</span> <span class='kw'>nil</span>
1183
+ <span class='kw'>end</span></pre>
1184
+ </td>
1185
+ </tr>
1186
+ </table>
1187
+ </div>
1188
+
1189
+ <div class="method_details ">
1190
+ <h3 class="signature " id="job_id=-instance_method">
1191
+
1192
+ #<strong>job_id=</strong>(value) &#x21d2; <tt>Object</tt>
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+ </h3><div class="docstring">
1199
+ <div class="discussion">
1200
+
1201
+ <p>Set job id.</p>
1202
+
1203
+
1204
+ </div>
1205
+ </div>
1206
+ <div class="tags">
1207
+ <p class="tag_title">Parameters:</p>
1208
+ <ul class="param">
1209
+
1210
+ <li>
1211
+
1212
+ <span class='name'>value</span>
1213
+
1214
+
1215
+ <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
1216
+
1217
+
1218
+
1219
+ &mdash;
1220
+ <div class='inline'>
1221
+ <p>Job id.</p>
1222
+ </div>
1223
+
1224
+ </li>
1225
+
1226
+ </ul>
1227
+
1228
+
1229
+ </div><table class="source_code">
1230
+ <tr>
1231
+ <td>
1232
+ <pre class="lines">
1233
+
1234
+
1235
+ 44
1236
+ 45
1237
+ 46</pre>
1238
+ </td>
1239
+ <td>
1240
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 44</span>
1241
+
1242
+ <span class='kw'>def</span> <span class='id identifier rubyid_job_id='>job_id=</span> <span class='id identifier rubyid_value'>value</span>
1243
+ <span class='ivar'>@job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
1244
+ <span class='kw'>end</span></pre>
1245
+ </td>
1246
+ </tr>
1247
+ </table>
1248
+ </div>
1249
+
1250
+ <div class="method_details ">
1251
+ <h3 class="signature " id="log-instance_method">
1252
+
1253
+ #<strong>log</strong>(text) &#x21d2; <tt>Object</tt>
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+ </h3><div class="docstring">
1260
+ <div class="discussion">
1261
+
1262
+ <p>Log text into stdout when verbose is enabled (see #verbose?).</p>
1263
+
1264
+
1265
+ </div>
1266
+ </div>
1267
+ <div class="tags">
1268
+ <p class="tag_title">Parameters:</p>
1269
+ <ul class="param">
1270
+
1271
+ <li>
1272
+
1273
+ <span class='name'>text</span>
1274
+
1275
+
1276
+ <span class='type'>(<tt>String</tt>)</span>
1277
+
1278
+
1279
+
1280
+ &mdash;
1281
+ <div class='inline'>
1282
+ <p>Message to be log.</p>
1283
+ </div>
1284
+
1285
+ </li>
1286
+
1287
+ </ul>
1288
+
1289
+
1290
+ </div><table class="source_code">
1291
+ <tr>
1292
+ <td>
1293
+ <pre class="lines">
1294
+
1295
+
1296
+ 51
1297
+ 52
1298
+ 53</pre>
1299
+ </td>
1300
+ <td>
1301
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 51</span>
1302
+
1303
+ <span class='kw'>def</span> <span class='id identifier rubyid_log'>log</span> <span class='id identifier rubyid_text'>text</span>
1304
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_text'>text</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verbose?'>verbose?</span>
1305
+ <span class='kw'>end</span></pre>
1306
+ </td>
1307
+ </tr>
1308
+ </table>
1309
+ </div>
1310
+
1311
+ <div class="method_details ">
1312
+ <h3 class="signature " id="record-instance_method">
1313
+
1314
+ #<strong>record</strong>(map) &#x21d2; <tt>Object</tt>
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+ </h3><div class="docstring">
1321
+ <div class="discussion">
1322
+
1323
+ <p>Record a page data into a specific directory.</p>
1324
+
1325
+
1326
+ </div>
1327
+ </div>
1328
+ <div class="tags">
1329
+ <p class="tag_title">Parameters:</p>
1330
+ <ul class="param">
1331
+
1332
+ <li>
1333
+
1334
+ <span class='name'>map</span>
1335
+
1336
+
1337
+ <span class='type'>(<tt>Hash</tt>)</span>
1338
+
1339
+
1340
+
1341
+ &mdash;
1342
+ <div class='inline'>
1343
+ <p>({}) Input map configuration.</p>
1344
+ </div>
1345
+
1346
+ </li>
1347
+
1348
+ </ul>
1349
+
1350
+
1351
+
1352
+
1353
+ <p class="tag_title">Options Hash (<tt>map</tt>):</p>
1354
+ <ul class="option">
1355
+
1356
+ <li>
1357
+ <span class="name">:gid</span>
1358
+ <span class="type">(<tt>String</tt>)</span>
1359
+ <span class="default">
1360
+
1361
+ </span>
1362
+
1363
+ &mdash; <div class='inline'>
1364
+ <p>Page `gid` to retrieve the data from.</p>
1365
+ </div>
1366
+
1367
+ </li>
1368
+
1369
+ <li>
1370
+ <span class="name">:dir</span>
1371
+ <span class="type">(<tt>String</tt>)</span>
1372
+ <span class="default">
1373
+
1374
+ </span>
1375
+
1376
+ &mdash; <div class='inline'>
1377
+ <p>Directory to save file into.</p>
1378
+ </div>
1379
+
1380
+ </li>
1381
+
1382
+ <li>
1383
+ <span class="name">:record_content</span>
1384
+ <span class="type">(<tt>Boolean</tt>)</span>
1385
+ <span class="default">
1386
+
1387
+ &mdash; default:
1388
+ <tt>true</tt>
1389
+
1390
+ </span>
1391
+
1392
+ &mdash; <div class='inline'>
1393
+ <p>Record content when `true`.</p>
1394
+ </div>
1395
+
1396
+ </li>
1397
+
1398
+ <li>
1399
+ <span class="name">:record_failed_content</span>
1400
+ <span class="type">(<tt>Boolean</tt>)</span>
1401
+ <span class="default">
1402
+
1403
+ &mdash; default:
1404
+ <tt>true</tt>
1405
+
1406
+ </span>
1407
+
1408
+ &mdash; <div class='inline'>
1409
+ <p>Record failed_cntent when `true`.</p>
1410
+ </div>
1411
+
1412
+ </li>
1413
+
1414
+ <li>
1415
+ <span class="name">:record_page</span>
1416
+ <span class="type">(<tt>Boolean</tt>)</span>
1417
+ <span class="default">
1418
+
1419
+ &mdash; default:
1420
+ <tt>true</tt>
1421
+
1422
+ </span>
1423
+
1424
+ &mdash; <div class='inline'>
1425
+ <p>Record page when `true`.</p>
1426
+ </div>
1427
+
1428
+ </li>
1429
+
1430
+ <li>
1431
+ <span class="name">:record_vars</span>
1432
+ <span class="type">(<tt>Boolean</tt>)</span>
1433
+ <span class="default">
1434
+
1435
+ &mdash; default:
1436
+ <tt>false</tt>
1437
+
1438
+ </span>
1439
+
1440
+ &mdash; <div class='inline'>
1441
+ <p>Record vars when `true`.</p>
1442
+ </div>
1443
+
1444
+ </li>
1445
+
1446
+ <li>
1447
+ <span class="name">:filters</span>
1448
+ <span class="type">(<tt>Hash</tt>)</span>
1449
+ <span class="default">
1450
+
1451
+ &mdash; default:
1452
+ <tt>{outputs:nil}</tt>
1453
+
1454
+ </span>
1455
+
1456
+ &mdash; <div class='inline'>
1457
+ <p>Filter hash for outputs recording, will record only when a filter is
1458
+ specify.</p>
1459
+ </div>
1460
+
1461
+ </li>
1462
+
1463
+ </ul>
1464
+
1465
+
1466
+ <p class="tag_title">Raises:</p>
1467
+ <ul class="raise">
1468
+
1469
+ <li>
1470
+
1471
+
1472
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1473
+
1474
+
1475
+
1476
+ </li>
1477
+
1478
+ </ul>
1479
+
1480
+ </div><table class="source_code">
1481
+ <tr>
1482
+ <td>
1483
+ <pre class="lines">
1484
+
1485
+
1486
+ 267
1487
+ 268
1488
+ 269
1489
+ 270
1490
+ 271
1491
+ 272
1492
+ 273
1493
+ 274
1494
+ 275
1495
+ 276
1496
+ 277
1497
+ 278
1498
+ 279
1499
+ 280
1500
+ 281
1501
+ 282
1502
+ 283
1503
+ 284
1504
+ 285
1505
+ 286
1506
+ 287
1507
+ 288
1508
+ 289
1509
+ 290
1510
+ 291
1511
+ 292
1512
+ 293
1513
+ 294
1514
+ 295
1515
+ 296
1516
+ 297
1517
+ 298
1518
+ 299
1519
+ 300
1520
+ 301</pre>
1521
+ </td>
1522
+ <td>
1523
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 267</span>
1524
+
1525
+ <span class='kw'>def</span> <span class='id identifier rubyid_record'>record</span> <span class='id identifier rubyid_map'>map</span>
1526
+ <span class='id identifier rubyid_map'>map</span> <span class='op'>=</span> <span class='lbrace'>{</span>
1527
+ <span class='label'>gid:</span> <span class='kw'>nil</span><span class='comma'>,</span>
1528
+ <span class='label'>dir:</span> <span class='kw'>nil</span><span class='comma'>,</span>
1529
+ <span class='label'>record_content:</span> <span class='kw'>true</span><span class='comma'>,</span>
1530
+ <span class='label'>record_failed_content:</span> <span class='kw'>true</span><span class='comma'>,</span>
1531
+ <span class='label'>record_page:</span> <span class='kw'>true</span><span class='comma'>,</span>
1532
+ <span class='label'>record_vars:</span> <span class='kw'>false</span><span class='comma'>,</span>
1533
+ <span class='label'>filters:</span> <span class='lbrace'>{</span>
1534
+ <span class='label'>outputs:</span> <span class='kw'>nil</span>
1535
+ <span class='rbrace'>}</span>
1536
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_map'>map</span>
1537
+
1538
+ <span class='id identifier rubyid_gid'>gid</span> <span class='op'>=</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:gid</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1539
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&quot;gid&quot; can\&#39;t be empty</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_gid'>gid</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1540
+ <span class='id identifier rubyid_dir'>dir</span> <span class='op'>=</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:dir</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
1541
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&quot;dir&quot; can\&#39;t be empty</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_dir'>dir</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1542
+ <span class='id identifier rubyid_dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='id identifier rubyid_root_dir'>root_dir</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span> <span class='kw'>unless</span> <span class='id identifier rubyid_root_dir'>root_dir</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_root_dir'>root_dir</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1543
+ <span class='id identifier rubyid_dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span> <span class='id identifier rubyid_dir'>dir</span>
1544
+ <span class='kw'>unless</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span> <span class='id identifier rubyid_dir'>dir</span>
1545
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dir'>dir</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; don&#39;t exists or is not a directory.</span><span class='tstring_end'>&quot;</span></span>
1546
+ <span class='kw'>end</span>
1547
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Recording on \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dir'>dir</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; directory...</span><span class='tstring_end'>&quot;</span></span>
1548
+
1549
+ <span class='id identifier rubyid_record_content'>record_content</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span> <span class='kw'>if</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:content</span><span class='rbracket'>]</span>
1550
+ <span class='id identifier rubyid_record_failed_content'>record_failed_content</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span> <span class='kw'>if</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:failed_content</span><span class='rbracket'>]</span>
1551
+ <span class='id identifier rubyid_record_page'>record_page</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span> <span class='kw'>if</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:page</span><span class='rbracket'>]</span>
1552
+ <span class='id identifier rubyid_record_vars'>record_vars</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span> <span class='kw'>if</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:vars</span><span class='rbracket'>]</span>
1553
+
1554
+ <span class='id identifier rubyid_filters'>filters</span> <span class='op'>=</span> <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='symbol'>:filters</span><span class='rbracket'>]</span>
1555
+ <span class='kw'>unless</span> <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1556
+ <span class='id identifier rubyid_record_outputs'>record_outputs</span> <span class='id identifier rubyid_filters'>filters</span><span class='lbracket'>[</span><span class='symbol'>:outputs</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_filters'>filters</span><span class='lbracket'>[</span><span class='symbol'>:outputs</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1557
+ <span class='kw'>end</span>
1558
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Finish recording \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dir'>dir</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; directory.</span><span class='tstring_end'>&quot;</span></span>
1559
+ <span class='kw'>end</span></pre>
1560
+ </td>
1561
+ </tr>
1562
+ </table>
1563
+ </div>
1564
+
1565
+ <div class="method_details ">
1566
+ <h3 class="signature " id="record_content-instance_method">
1567
+
1568
+ #<strong>record_content</strong>(gid, dir) &#x21d2; <tt>Object</tt>
1569
+
1570
+
1571
+
1572
+
1573
+
1574
+ </h3><div class="docstring">
1575
+ <div class="discussion">
1576
+
1577
+ <p>Record a page raw content (HTML, XML, excel, zip, etc.) into `content`</p>
1578
+
1579
+ <pre class="code ruby"><code class="ruby">file within the provided directory.
1580
+ </code></pre>
1581
+
1582
+
1583
+ </div>
1584
+ </div>
1585
+ <div class="tags">
1586
+ <p class="tag_title">Parameters:</p>
1587
+ <ul class="param">
1588
+
1589
+ <li>
1590
+
1591
+ <span class='name'>gid</span>
1592
+
1593
+
1594
+ <span class='type'>(<tt>String</tt>)</span>
1595
+
1596
+
1597
+
1598
+ &mdash;
1599
+ <div class='inline'>
1600
+ <p>Page `gid` to retrieve the data from.</p>
1601
+ </div>
1602
+
1603
+ </li>
1604
+
1605
+ <li>
1606
+
1607
+ <span class='name'>dir</span>
1608
+
1609
+
1610
+ <span class='type'>(<tt>String</tt>)</span>
1611
+
1612
+
1613
+
1614
+ &mdash;
1615
+ <div class='inline'>
1616
+ <p>Directory to save file into.</p>
1617
+ </div>
1618
+
1619
+ </li>
1620
+
1621
+ </ul>
1622
+
1623
+
1624
+ </div><table class="source_code">
1625
+ <tr>
1626
+ <td>
1627
+ <pre class="lines">
1628
+
1629
+
1630
+ 141
1631
+ 142
1632
+ 143
1633
+ 144
1634
+ 145</pre>
1635
+ </td>
1636
+ <td>
1637
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 141</span>
1638
+
1639
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_content'>record_content</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span>
1640
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_executor'>executor</span><span class='period'>.</span><span class='id identifier rubyid_get_content'>get_content</span> <span class='id identifier rubyid_gid'>gid</span>
1641
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1642
+ <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span>
1643
+ <span class='kw'>end</span></pre>
1644
+ </td>
1645
+ </tr>
1646
+ </table>
1647
+ </div>
1648
+
1649
+ <div class="method_details ">
1650
+ <h3 class="signature " id="record_failed_content-instance_method">
1651
+
1652
+ #<strong>record_failed_content</strong>(gid, dir) &#x21d2; <tt>Object</tt>
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+ </h3><div class="docstring">
1659
+ <div class="discussion">
1660
+
1661
+ <p>Record a page raw failed content (HTML, XML, excel, zip, etc.) into</p>
1662
+
1663
+ <pre class="code ruby"><code class="ruby">`failed_content` file within the provided directory.
1664
+ </code></pre>
1665
+
1666
+
1667
+ </div>
1668
+ </div>
1669
+ <div class="tags">
1670
+ <p class="tag_title">Parameters:</p>
1671
+ <ul class="param">
1672
+
1673
+ <li>
1674
+
1675
+ <span class='name'>gid</span>
1676
+
1677
+
1678
+ <span class='type'>(<tt>String</tt>)</span>
1679
+
1680
+
1681
+
1682
+ &mdash;
1683
+ <div class='inline'>
1684
+ <p>Page `gid` to retrieve the data from.</p>
1685
+ </div>
1686
+
1687
+ </li>
1688
+
1689
+ <li>
1690
+
1691
+ <span class='name'>dir</span>
1692
+
1693
+
1694
+ <span class='type'>(<tt>String</tt>)</span>
1695
+
1696
+
1697
+
1698
+ &mdash;
1699
+ <div class='inline'>
1700
+ <p>Directory to save file into.</p>
1701
+ </div>
1702
+
1703
+ </li>
1704
+
1705
+ </ul>
1706
+
1707
+
1708
+ </div><table class="source_code">
1709
+ <tr>
1710
+ <td>
1711
+ <pre class="lines">
1712
+
1713
+
1714
+ 152
1715
+ 153
1716
+ 154
1717
+ 155
1718
+ 156</pre>
1719
+ </td>
1720
+ <td>
1721
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 152</span>
1722
+
1723
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_failed_content'>record_failed_content</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span>
1724
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_executor'>executor</span><span class='period'>.</span><span class='id identifier rubyid_get_failed_content'>get_failed_content</span> <span class='id identifier rubyid_gid'>gid</span>
1725
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>failed_content</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1726
+ <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span>
1727
+ <span class='kw'>end</span></pre>
1728
+ </td>
1729
+ </tr>
1730
+ </table>
1731
+ </div>
1732
+
1733
+ <div class="method_details ">
1734
+ <h3 class="signature " id="record_file-instance_method">
1735
+
1736
+ #<strong>record_file</strong>(path, content) {|file| ... } &#x21d2; <tt>Object</tt>
1737
+
1738
+
1739
+
1740
+
1741
+
1742
+ </h3><div class="docstring">
1743
+ <div class="discussion">
1744
+
1745
+ <p>Record a content into a file only when the content is not null. It will</p>
1746
+
1747
+ <pre class="code ruby"><code class="ruby">delete the existing file regardless if a new file will be created or
1748
+ not.
1749
+ </code></pre>
1750
+
1751
+
1752
+ </div>
1753
+ </div>
1754
+ <div class="tags">
1755
+ <p class="tag_title">Parameters:</p>
1756
+ <ul class="param">
1757
+
1758
+ <li>
1759
+
1760
+ <span class='name'>path</span>
1761
+
1762
+
1763
+ <span class='type'>(<tt>String</tt>)</span>
1764
+
1765
+
1766
+
1767
+ &mdash;
1768
+ <div class='inline'>
1769
+ <p>File path to override.</p>
1770
+ </div>
1771
+
1772
+ </li>
1773
+
1774
+ <li>
1775
+
1776
+ <span class='name'>content</span>
1777
+
1778
+
1779
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
1780
+
1781
+
1782
+
1783
+ &mdash;
1784
+ <div class='inline'>
1785
+ <p>Content to be saved on the file.</p>
1786
+ </div>
1787
+
1788
+ </li>
1789
+
1790
+ </ul>
1791
+
1792
+ <p class="tag_title">Yield Parameters:</p>
1793
+ <ul class="yieldparam">
1794
+
1795
+ <li>
1796
+
1797
+ <span class='name'>file</span>
1798
+
1799
+
1800
+ <span class='type'>(<tt>File</tt>)</span>
1801
+
1802
+
1803
+
1804
+ &mdash;
1805
+ <div class='inline'>
1806
+ <p>File to save the data into.</p>
1807
+ </div>
1808
+
1809
+ </li>
1810
+
1811
+ </ul>
1812
+
1813
+ </div><table class="source_code">
1814
+ <tr>
1815
+ <td>
1816
+ <pre class="lines">
1817
+
1818
+
1819
+ 118
1820
+ 119
1821
+ 120
1822
+ 121
1823
+ 122
1824
+ 123
1825
+ 124
1826
+ 125
1827
+ 126
1828
+ 127
1829
+ 128
1830
+ 129
1831
+ 130
1832
+ 131
1833
+ 132
1834
+ 133
1835
+ 134</pre>
1836
+ </td>
1837
+ <td>
1838
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 118</span>
1839
+
1840
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
1841
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span> <span class='id identifier rubyid_path'>path</span>
1842
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Deleting old \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; file...</span><span class='tstring_end'>&quot;</span></span>
1843
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_path'>path</span>
1844
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Done.</span><span class='tstring_end'>&quot;</span></span>
1845
+ <span class='kw'>end</span>
1846
+ <span class='kw'>if</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1847
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Null content detected, skip file.</span><span class='tstring_end'>&#39;</span></span>
1848
+ <span class='kw'>return</span>
1849
+ <span class='kw'>end</span>
1850
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Creating \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_page'>page</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; file...</span><span class='tstring_end'>&quot;</span></span>
1851
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</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_file'>file</span><span class='op'>|</span>
1852
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_content'>content</span> <span class='kw'>unless</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1853
+ <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_file'>file</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1854
+ <span class='kw'>end</span>
1855
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Done.</span><span class='tstring_end'>&quot;</span></span>
1856
+ <span class='kw'>end</span></pre>
1857
+ </td>
1858
+ </tr>
1859
+ </table>
1860
+ </div>
1861
+
1862
+ <div class="method_details ">
1863
+ <h3 class="signature " id="record_outputs-instance_method">
1864
+
1865
+ #<strong>record_outputs</strong>(filter = nil) &#x21d2; <tt>Object</tt>
1866
+
1867
+
1868
+
1869
+
1870
+
1871
+ </h3><div class="docstring">
1872
+ <div class="discussion">
1873
+
1874
+ <div class="note notetag">
1875
+ <strong>Note:</strong>
1876
+ <div class='inline'>
1877
+ <p>Will skip when `nil` is provided as filters.</p>
1878
+ </div>
1879
+ </div>
1880
+
1881
+
1882
+ <p>Record a collection of outputs (JSON) into `outputs.json` file within</p>
1883
+
1884
+ <pre class="code ruby"><code class="ruby">the provided directory using filters on Datahen executor
1885
+ `find_outputs` method to retrieve all matching outputs regardless of
1886
+ pagination.
1887
+ </code></pre>
1888
+
1889
+
1890
+ </div>
1891
+ </div>
1892
+ <div class="tags">
1893
+ <p class="tag_title">Parameters:</p>
1894
+ <ul class="param">
1895
+
1896
+ <li>
1897
+
1898
+ <span class='name'>filter</span>
1899
+
1900
+
1901
+ <span class='type'>(<tt>Hash</tt>, <tt>nil</tt>)</span>
1902
+
1903
+
1904
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1905
+
1906
+
1907
+ &mdash;
1908
+ <div class='inline'>
1909
+ <p>(nil) Filters to retrieve `outputs`.</p>
1910
+ </div>
1911
+
1912
+ </li>
1913
+
1914
+ </ul>
1915
+
1916
+
1917
+
1918
+
1919
+ <p class="tag_title">Options Hash (<tt>filter</tt>):</p>
1920
+ <ul class="option">
1921
+
1922
+ <li>
1923
+ <span class="name">:collection</span>
1924
+ <span class="type">(<tt>String</tt>)</span>
1925
+ <span class="default">
1926
+
1927
+ &mdash; default:
1928
+ <tt>&#39;default&#39;</tt>
1929
+
1930
+ </span>
1931
+
1932
+ &mdash; <div class='inline'>
1933
+ <p>Output collection.</p>
1934
+ </div>
1935
+
1936
+ </li>
1937
+
1938
+ <li>
1939
+ <span class="name">:query</span>
1940
+ <span class="type">(<tt>Hash</tt>)</span>
1941
+ <span class="default">
1942
+
1943
+ &mdash; default:
1944
+ <tt>{}</tt>
1945
+
1946
+ </span>
1947
+
1948
+ &mdash; <div class='inline'>
1949
+ <p>Query that outputs should match.</p>
1950
+ </div>
1951
+
1952
+ </li>
1953
+
1954
+ <li>
1955
+ <span class="name">:opts</span>
1956
+ <span class="type">(<tt>Hash</tt>)</span>
1957
+ <span class="default">
1958
+
1959
+ &mdash; default:
1960
+ <tt>{}</tt>
1961
+
1962
+ </span>
1963
+
1964
+ &mdash; <div class='inline'>
1965
+ <p>`find_outputs` configuration options (see
1966
+ Datahen::Scraper::Executor#find_outputs for details).</p>
1967
+ </div>
1968
+
1969
+ </li>
1970
+
1971
+ </ul>
1972
+
1973
+
1974
+
1975
+ </div><table class="source_code">
1976
+ <tr>
1977
+ <td>
1978
+ <pre class="lines">
1979
+
1980
+
1981
+ 212
1982
+ 213
1983
+ 214
1984
+ 215
1985
+ 216
1986
+ 217
1987
+ 218
1988
+ 219
1989
+ 220
1990
+ 221
1991
+ 222
1992
+ 223
1993
+ 224
1994
+ 225
1995
+ 226
1996
+ 227
1997
+ 228
1998
+ 229
1999
+ 230
2000
+ 231
2001
+ 232
2002
+ 233
2003
+ 234
2004
+ 235
2005
+ 236
2006
+ 237
2007
+ 238
2008
+ 239
2009
+ 240
2010
+ 241
2011
+ 242
2012
+ 243
2013
+ 244
2014
+ 245
2015
+ 246
2016
+ 247
2017
+ 248
2018
+ 249
2019
+ 250
2020
+ 251
2021
+ 252
2022
+ 253</pre>
2023
+ </td>
2024
+ <td>
2025
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 212</span>
2026
+
2027
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_outputs'>record_outputs</span> <span class='id identifier rubyid_filter'>filter</span> <span class='op'>=</span> <span class='kw'>nil</span>
2028
+ <span class='kw'>if</span> <span class='id identifier rubyid_filter'>filter</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
2029
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Skip outputs, no filter detected.</span><span class='tstring_end'>&#39;</span></span>
2030
+ <span class='kw'>return</span>
2031
+ <span class='kw'>end</span>
2032
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>outputs.json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2033
+ <span class='id identifier rubyid_filter'>filter</span> <span class='op'>=</span> <span class='lbrace'>{</span>
2034
+ <span class='label'>collection:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>default</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
2035
+ <span class='label'>query:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span>
2036
+ <span class='label'>opts:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
2037
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_filter'>filter</span>
2038
+
2039
+ <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span>
2040
+ <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='int'>0</span>
2041
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='int'>1</span>
2042
+ <span class='id identifier rubyid_outputs'>outputs</span> <span class='op'>=</span> <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_find_outputs'>find_outputs</span><span class='lparen'>(</span>
2043
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='comma'>,</span>
2044
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:query</span><span class='rbracket'>]</span><span class='comma'>,</span>
2045
+ <span class='id identifier rubyid_page'>page</span><span class='comma'>,</span>
2046
+ <span class='int'>100</span><span class='comma'>,</span>
2047
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:opts</span><span class='rbracket'>]</span>
2048
+ <span class='rparen'>)</span>
2049
+
2050
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[</span><span class='tstring_end'>&#39;</span></span>
2051
+ <span class='kw'>while</span> <span class='op'>!</span><span class='id identifier rubyid_outputs'>outputs</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_outputs'>outputs</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&gt;</span> <span class='int'>0</span>
2052
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>+=</span> <span class='int'>1</span>
2053
+ <span class='id identifier rubyid_outputs'>outputs</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_output'>output</span><span class='op'>|</span>
2054
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>&gt;</span> <span class='int'>0</span>
2055
+ <span class='id identifier rubyid_count'>count</span> <span class='op'>+=</span> <span class='int'>1</span>
2056
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
2057
+ <span class='kw'>end</span>
2058
+ <span class='id identifier rubyid_outputs'>outputs</span> <span class='op'>=</span> <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_find_outputs'>find_outputs</span><span class='lparen'>(</span>
2059
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='comma'>,</span>
2060
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:query</span><span class='rbracket'>]</span><span class='comma'>,</span>
2061
+ <span class='id identifier rubyid_page'>page</span><span class='comma'>,</span>
2062
+ <span class='int'>100</span><span class='comma'>,</span>
2063
+ <span class='id identifier rubyid_filter'>filter</span><span class='lbracket'>[</span><span class='symbol'>:opts</span><span class='rbracket'>]</span>
2064
+ <span class='rparen'>)</span>
2065
+ <span class='kw'>end</span>
2066
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>]</span><span class='tstring_end'>&#39;</span></span>
2067
+ <span class='kw'>end</span>
2068
+ <span class='kw'>end</span></pre>
2069
+ </td>
2070
+ </tr>
2071
+ </table>
2072
+ </div>
2073
+
2074
+ <div class="method_details ">
2075
+ <h3 class="signature " id="record_page-instance_method">
2076
+
2077
+ #<strong>record_page</strong>(gid, dir) &#x21d2; <tt>Object</tt>
2078
+
2079
+
2080
+
2081
+
2082
+
2083
+ </h3><div class="docstring">
2084
+ <div class="discussion">
2085
+
2086
+ <div class="note notetag">
2087
+ <strong>Note:</strong>
2088
+ <div class='inline'>
2089
+ <p>It will prefer job page definition over global page unless no `job_id` (see
2090
+ #job_id) or `scraper_name` (see #scraper_name) is defined.</p>
2091
+ </div>
2092
+ </div>
2093
+
2094
+
2095
+ <p>Record a page&#39;s global or job definition (JSON) into `page.json` file</p>
2096
+
2097
+ <pre class="code ruby"><code class="ruby">within the provided directory.
2098
+ </code></pre>
2099
+
2100
+
2101
+ </div>
2102
+ </div>
2103
+ <div class="tags">
2104
+ <p class="tag_title">Parameters:</p>
2105
+ <ul class="param">
2106
+
2107
+ <li>
2108
+
2109
+ <span class='name'>gid</span>
2110
+
2111
+
2112
+ <span class='type'>(<tt>String</tt>)</span>
2113
+
2114
+
2115
+
2116
+ &mdash;
2117
+ <div class='inline'>
2118
+ <p>Page `gid` to retrieve the data from.</p>
2119
+ </div>
2120
+
2121
+ </li>
2122
+
2123
+ <li>
2124
+
2125
+ <span class='name'>dir</span>
2126
+
2127
+
2128
+ <span class='type'>(<tt>String</tt>)</span>
2129
+
2130
+
2131
+
2132
+ &mdash;
2133
+ <div class='inline'>
2134
+ <p>Directory to save file into.</p>
2135
+ </div>
2136
+
2137
+ </li>
2138
+
2139
+ </ul>
2140
+
2141
+
2142
+ </div><table class="source_code">
2143
+ <tr>
2144
+ <td>
2145
+ <pre class="lines">
2146
+
2147
+
2148
+ 167
2149
+ 168
2150
+ 169
2151
+ 170
2152
+ 171
2153
+ 172
2154
+ 173
2155
+ 174
2156
+ 175
2157
+ 176
2158
+ 177</pre>
2159
+ </td>
2160
+ <td>
2161
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 167</span>
2162
+
2163
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_page'>record_page</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span>
2164
+ <span class='kw'>if</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
2165
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Warning: No &quot;scraper_name&quot; or &quot;job_id&quot; was specified, will use global page instead job page.</span><span class='tstring_end'>&#39;</span></span>
2166
+ <span class='kw'>end</span>
2167
+ <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_gid'>gid</span> <span class='op'>=</span> <span class='id identifier rubyid_gid'>gid</span>
2168
+ <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_job_id'>job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_job_id'>job_id</span>
2169
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_init_page'>init_page</span><span class='lparen'>(</span><span class='rparen'>)</span>
2170
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span> <span class='id identifier rubyid_page'>page</span>
2171
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>page.json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2172
+ <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span>
2173
+ <span class='kw'>end</span></pre>
2174
+ </td>
2175
+ </tr>
2176
+ </table>
2177
+ </div>
2178
+
2179
+ <div class="method_details ">
2180
+ <h3 class="signature " id="record_pages-instance_method">
2181
+
2182
+ #<strong>record_pages</strong>(input_map) &#x21d2; <tt>Object</tt>
2183
+
2184
+
2185
+
2186
+
2187
+
2188
+ </h3><div class="docstring">
2189
+ <div class="discussion">
2190
+
2191
+ <p>Record pages from an input map collection.</p>
2192
+
2193
+
2194
+ </div>
2195
+ </div>
2196
+ <div class="tags">
2197
+ <p class="tag_title">Parameters:</p>
2198
+ <ul class="param">
2199
+
2200
+ <li>
2201
+
2202
+ <span class='name'>input_map</span>
2203
+
2204
+
2205
+ <span class='type'>(<tt>Array</tt>)</span>
2206
+
2207
+
2208
+
2209
+ &mdash;
2210
+ <div class='inline'>
2211
+ <p>Input map collection (see #input_map for structure).</p>
2212
+ </div>
2213
+
2214
+ </li>
2215
+
2216
+ </ul>
2217
+
2218
+
2219
+ </div><table class="source_code">
2220
+ <tr>
2221
+ <td>
2222
+ <pre class="lines">
2223
+
2224
+
2225
+ 307
2226
+ 308
2227
+ 309
2228
+ 310
2229
+ 311
2230
+ 312
2231
+ 313</pre>
2232
+ </td>
2233
+ <td>
2234
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 307</span>
2235
+
2236
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_pages'>record_pages</span> <span class='id identifier rubyid_input_map'>input_map</span>
2237
+ <span class='id identifier rubyid_ensure_job_id'>ensure_job_id</span>
2238
+ <span class='id identifier rubyid_input_map'>input_map</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_map'>map</span><span class='op'>|</span>
2239
+
2240
+ <span class='id identifier rubyid_record_page'>record_page</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
2241
+ <span class='kw'>end</span>
2242
+ <span class='kw'>end</span></pre>
2243
+ </td>
2244
+ </tr>
2245
+ </table>
2246
+ </div>
2247
+
2248
+ <div class="method_details ">
2249
+ <h3 class="signature " id="record_vars-instance_method">
2250
+
2251
+ #<strong>record_vars</strong>(gid, dir) &#x21d2; <tt>Object</tt>
2252
+
2253
+
2254
+
2255
+
2256
+
2257
+ </h3><div class="docstring">
2258
+ <div class="discussion">
2259
+
2260
+ <div class="note notetag">
2261
+ <strong>Note:</strong>
2262
+ <div class='inline'>
2263
+ <p>It will skip it if no `job_id` (see #job_id) or `scraper_name` (see
2264
+ #scraper_name) is defined.</p>
2265
+ </div>
2266
+ </div>
2267
+
2268
+
2269
+ <p>Record a page&#39;s vars from job page definition (JSON) into `vars.json`</p>
2270
+
2271
+ <pre class="code ruby"><code class="ruby">file within the provided directory.
2272
+ </code></pre>
2273
+
2274
+
2275
+ </div>
2276
+ </div>
2277
+ <div class="tags">
2278
+ <p class="tag_title">Parameters:</p>
2279
+ <ul class="param">
2280
+
2281
+ <li>
2282
+
2283
+ <span class='name'>gid</span>
2284
+
2285
+
2286
+ <span class='type'>(<tt>String</tt>)</span>
2287
+
2288
+
2289
+
2290
+ &mdash;
2291
+ <div class='inline'>
2292
+ <p>Page `gid` to retrieve the data from.</p>
2293
+ </div>
2294
+
2295
+ </li>
2296
+
2297
+ <li>
2298
+
2299
+ <span class='name'>dir</span>
2300
+
2301
+
2302
+ <span class='type'>(<tt>String</tt>)</span>
2303
+
2304
+
2305
+
2306
+ &mdash;
2307
+ <div class='inline'>
2308
+ <p>Directory to save file into.</p>
2309
+ </div>
2310
+
2311
+ </li>
2312
+
2313
+ </ul>
2314
+
2315
+
2316
+ </div><table class="source_code">
2317
+ <tr>
2318
+ <td>
2319
+ <pre class="lines">
2320
+
2321
+
2322
+ 187
2323
+ 188
2324
+ 189
2325
+ 190
2326
+ 191
2327
+ 192
2328
+ 193
2329
+ 194
2330
+ 195
2331
+ 196
2332
+ 197
2333
+ 198</pre>
2334
+ </td>
2335
+ <td>
2336
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 187</span>
2337
+
2338
+ <span class='kw'>def</span> <span class='id identifier rubyid_record_vars'>record_vars</span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span>
2339
+ <span class='kw'>if</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
2340
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Warning: No &quot;scraper_name&quot; or &quot;job_id&quot; was specified, will skip vars.</span><span class='tstring_end'>&#39;</span></span>
2341
+ <span class='kw'>return</span>
2342
+ <span class='kw'>end</span>
2343
+ <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_gid'>gid</span> <span class='op'>=</span> <span class='id identifier rubyid_gid'>gid</span>
2344
+ <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_job_id'>job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_job_id'>job_id</span>
2345
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='ivar'>@executor</span><span class='period'>.</span><span class='id identifier rubyid_init_page'>init_page</span><span class='lparen'>(</span><span class='rparen'>)</span>
2346
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span> <span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>vars</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
2347
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>vars.json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
2348
+ <span class='id identifier rubyid_record_file'>record_file</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span>
2349
+ <span class='kw'>end</span></pre>
2350
+ </td>
2351
+ </tr>
2352
+ </table>
2353
+ </div>
2354
+
2355
+ <div class="method_details ">
2356
+ <h3 class="signature " id="root_dir-instance_method">
2357
+
2358
+ #<strong>root_dir</strong> &#x21d2; <tt>String</tt><sup>?</sup>
2359
+
2360
+
2361
+
2362
+
2363
+
2364
+ </h3><div class="docstring">
2365
+ <div class="discussion">
2366
+
2367
+ <p>Root directory to record pages. Useful to reduce input map fingerprint.</p>
2368
+
2369
+
2370
+ </div>
2371
+ </div>
2372
+ <div class="tags">
2373
+
2374
+ <p class="tag_title">Returns:</p>
2375
+ <ul class="return">
2376
+
2377
+ <li>
2378
+
2379
+
2380
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
2381
+
2382
+
2383
+
2384
+ </li>
2385
+
2386
+ </ul>
2387
+
2388
+ </div><table class="source_code">
2389
+ <tr>
2390
+ <td>
2391
+ <pre class="lines">
2392
+
2393
+
2394
+ 58
2395
+ 59
2396
+ 60</pre>
2397
+ </td>
2398
+ <td>
2399
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 58</span>
2400
+
2401
+ <span class='kw'>def</span> <span class='id identifier rubyid_root_dir'>root_dir</span>
2402
+ <span class='ivar'>@root</span> <span class='op'>||=</span> <span class='kw'>nil</span>
2403
+ <span class='kw'>end</span></pre>
2404
+ </td>
2405
+ </tr>
2406
+ </table>
2407
+ </div>
2408
+
2409
+ <div class="method_details ">
2410
+ <h3 class="signature " id="verbose?-instance_method">
2411
+
2412
+ #<strong>verbose?</strong> &#x21d2; <tt>Boolean</tt>
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+ </h3><div class="docstring">
2419
+ <div class="discussion">
2420
+
2421
+ <div class="note notetag">
2422
+ <strong>Note:</strong>
2423
+ <div class='inline'>
2424
+ <p>Default value is `true`.</p>
2425
+ </div>
2426
+ </div>
2427
+
2428
+
2429
+ <p>Will show logs on stdout when enabled (see #enable_verbose and</p>
2430
+
2431
+ <pre class="code ruby"><code class="ruby"><span class='comment'>#disable_verbose)
2432
+ </span></code></pre>
2433
+
2434
+
2435
+ </div>
2436
+ </div>
2437
+ <div class="tags">
2438
+
2439
+ <p class="tag_title">Returns:</p>
2440
+ <ul class="return">
2441
+
2442
+ <li>
2443
+
2444
+
2445
+ <span class='type'>(<tt>Boolean</tt>)</span>
2446
+
2447
+
2448
+
2449
+ &mdash;
2450
+ <div class='inline'>
2451
+ <p>`true` when enabled, else `false`.</p>
2452
+ </div>
2453
+
2454
+ </li>
2455
+
2456
+ </ul>
2457
+
2458
+ </div><table class="source_code">
2459
+ <tr>
2460
+ <td>
2461
+ <pre class="lines">
2462
+
2463
+
2464
+ 19
2465
+ 20
2466
+ 21
2467
+ 22</pre>
2468
+ </td>
2469
+ <td>
2470
+ <pre class="code"><span class="info file"># File 'lib/dh_easy/test/rake.rb', line 19</span>
2471
+
2472
+ <span class='kw'>def</span> <span class='id identifier rubyid_verbose?'>verbose?</span>
2473
+ <span class='ivar'>@verbose</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@verbose</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
2474
+ <span class='ivar'>@verbose</span>
2475
+ <span class='kw'>end</span></pre>
2476
+ </td>
2477
+ </tr>
2478
+ </table>
2479
+ </div>
2480
+
2481
+ </div>
2482
+
2483
+ </div>
2484
+
2485
+ <div id="footer">
2486
+ Generated on Wed Dec 4 23:16:05 2019 by
2487
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2488
+ 0.9.20 (ruby-2.5.3).
2489
+ </div>
2490
+
2491
+ </div>
2492
+ </body>
2493
+ </html>