csv_decision 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -0
  3. data/.gitignore +2 -1
  4. data/.travis.yml +2 -3
  5. data/CHANGELOG.md +19 -1
  6. data/README.md +49 -16
  7. data/{benchmark.rb → benchmarks/rufus_decision.rb} +1 -1
  8. data/csv_decision.gemspec +1 -1
  9. data/doc/CSVDecision/CellValidationError.html +143 -0
  10. data/doc/CSVDecision/Columns/Default.html +409 -0
  11. data/doc/CSVDecision/Columns/Dictionary.html +410 -0
  12. data/doc/CSVDecision/Columns/Entry.html +321 -0
  13. data/doc/CSVDecision/Columns.html +476 -0
  14. data/doc/CSVDecision/Constant.html +295 -0
  15. data/doc/CSVDecision/Data.html +344 -0
  16. data/doc/CSVDecision/Decide.html +434 -0
  17. data/doc/CSVDecision/Decision.html +604 -0
  18. data/doc/CSVDecision/Error.html +139 -0
  19. data/doc/CSVDecision/FileError.html +143 -0
  20. data/doc/CSVDecision/Function.html +229 -0
  21. data/doc/CSVDecision/Header.html +520 -0
  22. data/doc/CSVDecision/Input.html +305 -0
  23. data/doc/CSVDecision/Load.html +225 -0
  24. data/doc/CSVDecision/Matchers/Constant.html +242 -0
  25. data/doc/CSVDecision/Matchers/Function.html +342 -0
  26. data/doc/CSVDecision/Matchers/Matcher.html +325 -0
  27. data/doc/CSVDecision/Matchers/Numeric.html +277 -0
  28. data/doc/CSVDecision/Matchers/Pattern.html +600 -0
  29. data/doc/CSVDecision/Matchers/Range.html +413 -0
  30. data/doc/CSVDecision/Matchers/Symbol.html +280 -0
  31. data/doc/CSVDecision/Matchers.html +1529 -0
  32. data/doc/CSVDecision/Numeric.html +259 -0
  33. data/doc/CSVDecision/Options.html +445 -0
  34. data/doc/CSVDecision/Parse.html +270 -0
  35. data/doc/CSVDecision/ScanRow.html +746 -0
  36. data/doc/CSVDecision/Symbol.html +256 -0
  37. data/doc/CSVDecision/Table.html +1115 -0
  38. data/doc/CSVDecision.html +652 -0
  39. data/doc/_index.html +410 -0
  40. data/doc/class_list.html +51 -0
  41. data/doc/css/common.css +1 -0
  42. data/doc/css/full_list.css +58 -0
  43. data/doc/css/style.css +499 -0
  44. data/doc/file.README.html +264 -0
  45. data/doc/file_list.html +56 -0
  46. data/doc/frames.html +17 -0
  47. data/doc/index.html +264 -0
  48. data/doc/js/app.js +248 -0
  49. data/doc/js/full_list.js +216 -0
  50. data/doc/js/jquery.js +4 -0
  51. data/doc/method_list.html +683 -0
  52. data/doc/top-level-namespace.html +110 -0
  53. data/lib/csv_decision/columns.rb +15 -12
  54. data/lib/csv_decision/constant.rb +54 -0
  55. data/lib/csv_decision/decide.rb +5 -5
  56. data/lib/csv_decision/decision.rb +3 -1
  57. data/lib/csv_decision/function.rb +32 -0
  58. data/lib/csv_decision/header.rb +27 -18
  59. data/lib/csv_decision/input.rb +11 -8
  60. data/lib/csv_decision/matchers/constant.rb +18 -0
  61. data/lib/csv_decision/matchers/function.rb +11 -44
  62. data/lib/csv_decision/matchers/numeric.rb +5 -33
  63. data/lib/csv_decision/matchers/pattern.rb +26 -11
  64. data/lib/csv_decision/matchers/range.rb +21 -5
  65. data/lib/csv_decision/matchers/symbol.rb +20 -0
  66. data/lib/csv_decision/matchers.rb +85 -20
  67. data/lib/csv_decision/numeric.rb +38 -0
  68. data/lib/csv_decision/options.rb +36 -27
  69. data/lib/csv_decision/parse.rb +46 -39
  70. data/lib/csv_decision/scan_row.rb +19 -7
  71. data/lib/csv_decision/symbol.rb +73 -0
  72. data/lib/csv_decision/table.rb +24 -18
  73. data/lib/csv_decision.rb +25 -18
  74. data/spec/csv_decision/columns_spec.rb +1 -1
  75. data/spec/csv_decision/constant_spec.rb +60 -0
  76. data/spec/csv_decision/examples_spec.rb +119 -0
  77. data/spec/csv_decision/matchers/function_spec.rb +48 -28
  78. data/spec/csv_decision/matchers/numeric_spec.rb +4 -41
  79. data/spec/csv_decision/matchers/range_spec.rb +31 -61
  80. data/spec/csv_decision/matchers/symbol_spec.rb +65 -0
  81. data/spec/csv_decision/options_spec.rb +14 -2
  82. data/spec/csv_decision/parse_spec.rb +10 -0
  83. data/spec/csv_decision/table_spec.rb +112 -6
  84. data/spec/data/valid/simple_constants.csv +3 -3
  85. metadata +62 -7
  86. data/spec/csv_decision/simple_example_spec.rb +0 -75
  87. /data/spec/{csv_decision.rb → csv_decision_spec.rb} +0 -0
@@ -0,0 +1,746 @@
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: CSVDecision::ScanRow
8
+
9
+ &mdash; Documentation by YARD 0.9.12
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 = "CSVDecision::ScanRow";
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 (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span>
41
+ &raquo;
42
+ <span class="title">ScanRow</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: CSVDecision::ScanRow
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">CSVDecision::ScanRow</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/csv_decision/scan_row.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Data row object indicating which columns are constants versus procs.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#constants-instance_method" title="#constants (instance method)">#<strong>constants</strong> &#x21d2; Array&lt;Integer&gt; </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+ <span class="note title readonly">readonly</span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>Column indices for simple constants.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature">
151
+
152
+ <a href="#procs-instance_method" title="#procs (instance method)">#<strong>procs</strong> &#x21d2; Array&lt;Integer&gt; </a>
153
+
154
+
155
+
156
+ </span>
157
+
158
+
159
+
160
+
161
+ <span class="note title readonly">readonly</span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'>
172
+ <p>Column indices for Proc objects.</p>
173
+ </div></span>
174
+
175
+ </li>
176
+
177
+
178
+ </ul>
179
+
180
+
181
+
182
+
183
+
184
+ <h2>
185
+ Instance Method Summary
186
+ <small><a href="#" class="summary_toggle">collapse</a></small>
187
+ </h2>
188
+
189
+ <ul class="summary">
190
+
191
+ <li class="public ">
192
+ <span class="summary_signature">
193
+
194
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; ScanRow </a>
195
+
196
+
197
+
198
+ </span>
199
+
200
+
201
+ <span class="note title constructor">constructor</span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <span class="summary_desc"><div class='inline'>
211
+ <p>A new instance of ScanRow.</p>
212
+ </div></span>
213
+
214
+ </li>
215
+
216
+
217
+ <li class="public ">
218
+ <span class="summary_signature">
219
+
220
+ <a href="#match_constants%3F-instance_method" title="#match_constants? (instance method)">#<strong>match_constants?</strong>(row:, scan_cols:) &#x21d2; Boolean </a>
221
+
222
+
223
+
224
+ </span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'></div></span>
235
+
236
+ </li>
237
+
238
+
239
+ <li class="public ">
240
+ <span class="summary_signature">
241
+
242
+ <a href="#match_procs%3F-instance_method" title="#match_procs? (instance method)">#<strong>match_procs?</strong>(row:, input:) &#x21d2; Boolean </a>
243
+
244
+
245
+
246
+ </span>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <span class="summary_desc"><div class='inline'></div></span>
257
+
258
+ </li>
259
+
260
+
261
+ <li class="public ">
262
+ <span class="summary_signature">
263
+
264
+ <a href="#scan_columns-instance_method" title="#scan_columns (instance method)">#<strong>scan_columns</strong>(row:, columns:, matchers:) &#x21d2; Array </a>
265
+
266
+
267
+
268
+ </span>
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'>
279
+ <p>Scan all the specified <code>columns</code> (e.g., inputs) in the given
280
+ <code>data</code> row using the <code>matchers</code> array supplied.</p>
281
+ </div></span>
282
+
283
+ </li>
284
+
285
+
286
+ </ul>
287
+
288
+
289
+ <div id="constructor_details" class="method_details_list">
290
+ <h2>Constructor Details</h2>
291
+
292
+ <div class="method_details first">
293
+ <h3 class="signature first" id="initialize-instance_method">
294
+
295
+ #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="CSVDecision::ScanRow (class)">ScanRow</a></span></tt>
296
+
297
+
298
+
299
+
300
+
301
+ </h3><div class="docstring">
302
+ <div class="discussion">
303
+
304
+ <p>Returns a new instance of ScanRow</p>
305
+
306
+
307
+ </div>
308
+ </div>
309
+ <div class="tags">
310
+
311
+
312
+ </div><table class="source_code">
313
+ <tr>
314
+ <td>
315
+ <pre class="lines">
316
+
317
+
318
+ 17
319
+ 18
320
+ 19
321
+ 20</pre>
322
+ </td>
323
+ <td>
324
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 17</span>
325
+
326
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
327
+ <span class='ivar'>@constants</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
328
+ <span class='ivar'>@procs</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
329
+ <span class='kw'>end</span></pre>
330
+ </td>
331
+ </tr>
332
+ </table>
333
+ </div>
334
+
335
+ </div>
336
+
337
+ <div id="instance_attr_details" class="attr_details">
338
+ <h2>Instance Attribute Details</h2>
339
+
340
+
341
+ <span id=""></span>
342
+ <div class="method_details first">
343
+ <h3 class="signature first" id="constants-instance_method">
344
+
345
+ #<strong>constants</strong> &#x21d2; <tt>Array&lt;Integer&gt;</tt> <span class="extras">(readonly)</span>
346
+
347
+
348
+
349
+
350
+
351
+ </h3><div class="docstring">
352
+ <div class="discussion">
353
+
354
+ <p>Returns Column indices for simple constants.</p>
355
+
356
+
357
+ </div>
358
+ </div>
359
+ <div class="tags">
360
+
361
+ <p class="tag_title">Returns:</p>
362
+ <ul class="return">
363
+
364
+ <li>
365
+
366
+
367
+ <span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
368
+
369
+
370
+
371
+ &mdash;
372
+ <div class='inline'>
373
+ <p>Column indices for simple constants.</p>
374
+ </div>
375
+
376
+ </li>
377
+
378
+ </ul>
379
+
380
+ </div><table class="source_code">
381
+ <tr>
382
+ <td>
383
+ <pre class="lines">
384
+
385
+
386
+ 12
387
+ 13
388
+ 14</pre>
389
+ </td>
390
+ <td>
391
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 12</span>
392
+
393
+ <span class='kw'>def</span> <span class='id identifier rubyid_constants'>constants</span>
394
+ <span class='ivar'>@constants</span>
395
+ <span class='kw'>end</span></pre>
396
+ </td>
397
+ </tr>
398
+ </table>
399
+ </div>
400
+
401
+
402
+ <span id=""></span>
403
+ <div class="method_details ">
404
+ <h3 class="signature " id="procs-instance_method">
405
+
406
+ #<strong>procs</strong> &#x21d2; <tt>Array&lt;Integer&gt;</tt> <span class="extras">(readonly)</span>
407
+
408
+
409
+
410
+
411
+
412
+ </h3><div class="docstring">
413
+ <div class="discussion">
414
+
415
+ <p>Returns Column indices for Proc objects.</p>
416
+
417
+
418
+ </div>
419
+ </div>
420
+ <div class="tags">
421
+
422
+ <p class="tag_title">Returns:</p>
423
+ <ul class="return">
424
+
425
+ <li>
426
+
427
+
428
+ <span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
429
+
430
+
431
+
432
+ &mdash;
433
+ <div class='inline'>
434
+ <p>Column indices for Proc objects.</p>
435
+ </div>
436
+
437
+ </li>
438
+
439
+ </ul>
440
+
441
+ </div><table class="source_code">
442
+ <tr>
443
+ <td>
444
+ <pre class="lines">
445
+
446
+
447
+ 15
448
+ 16
449
+ 17</pre>
450
+ </td>
451
+ <td>
452
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 15</span>
453
+
454
+ <span class='kw'>def</span> <span class='id identifier rubyid_procs'>procs</span>
455
+ <span class='ivar'>@procs</span>
456
+ <span class='kw'>end</span></pre>
457
+ </td>
458
+ </tr>
459
+ </table>
460
+ </div>
461
+
462
+ </div>
463
+
464
+
465
+ <div id="instance_method_details" class="method_details_list">
466
+ <h2>Instance Method Details</h2>
467
+
468
+
469
+ <div class="method_details first">
470
+ <h3 class="signature first" id="match_constants?-instance_method">
471
+
472
+ #<strong>match_constants?</strong>(row:, scan_cols:) &#x21d2; <tt>Boolean</tt>
473
+
474
+
475
+
476
+
477
+
478
+ </h3><div class="docstring">
479
+ <div class="discussion">
480
+
481
+
482
+ </div>
483
+ </div>
484
+ <div class="tags">
485
+
486
+ <p class="tag_title">Returns:</p>
487
+ <ul class="return">
488
+
489
+ <li>
490
+
491
+
492
+ <span class='type'>(<tt>Boolean</tt>)</span>
493
+
494
+
495
+
496
+ </li>
497
+
498
+ </ul>
499
+
500
+ </div><table class="source_code">
501
+ <tr>
502
+ <td>
503
+ <pre class="lines">
504
+
505
+
506
+ 45
507
+ 46
508
+ 47
509
+ 48
510
+ 49
511
+ 50
512
+ 51</pre>
513
+ </td>
514
+ <td>
515
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 45</span>
516
+
517
+ <span class='kw'>def</span> <span class='id identifier rubyid_match_constants?'>match_constants?</span><span class='lparen'>(</span><span class='label'>row:</span><span class='comma'>,</span> <span class='label'>scan_cols:</span><span class='rparen'>)</span>
518
+ <span class='id identifier rubyid_constants'>constants</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_col'>col</span><span class='op'>|</span>
519
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_scan_cols'>scan_cols</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span>
520
+ <span class='kw'>end</span>
521
+
522
+ <span class='kw'>true</span>
523
+ <span class='kw'>end</span></pre>
524
+ </td>
525
+ </tr>
526
+ </table>
527
+ </div>
528
+
529
+ <div class="method_details ">
530
+ <h3 class="signature " id="match_procs?-instance_method">
531
+
532
+ #<strong>match_procs?</strong>(row:, input:) &#x21d2; <tt>Boolean</tt>
533
+
534
+
535
+
536
+
537
+
538
+ </h3><div class="docstring">
539
+ <div class="discussion">
540
+
541
+
542
+ </div>
543
+ </div>
544
+ <div class="tags">
545
+
546
+ <p class="tag_title">Returns:</p>
547
+ <ul class="return">
548
+
549
+ <li>
550
+
551
+
552
+ <span class='type'>(<tt>Boolean</tt>)</span>
553
+
554
+
555
+
556
+ </li>
557
+
558
+ </ul>
559
+
560
+ </div><table class="source_code">
561
+ <tr>
562
+ <td>
563
+ <pre class="lines">
564
+
565
+
566
+ 53
567
+ 54
568
+ 55
569
+ 56
570
+ 57
571
+ 58
572
+ 59
573
+ 60
574
+ 61
575
+ 62
576
+ 63</pre>
577
+ </td>
578
+ <td>
579
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 53</span>
580
+
581
+ <span class='kw'>def</span> <span class='id identifier rubyid_match_procs?'>match_procs?</span><span class='lparen'>(</span><span class='label'>row:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='rparen'>)</span>
582
+ <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:hash</span><span class='rbracket'>]</span>
583
+ <span class='id identifier rubyid_scan_cols'>scan_cols</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:scan_cols</span><span class='rbracket'>]</span>
584
+
585
+ <span class='id identifier rubyid_procs'>procs</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_col'>col</span><span class='op'>|</span>
586
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Decide.html" title="CSVDecision::Decide (module)">Decide</a></span></span><span class='period'>.</span><span class='id identifier rubyid_eval_matcher'><span class='object_link'><a href="Decide.html#eval_matcher-class_method" title="CSVDecision::Decide.eval_matcher (method)">eval_matcher</a></span></span><span class='lparen'>(</span><span class='label'>proc:</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>value:</span> <span class='id identifier rubyid_scan_cols'>scan_cols</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>hash:</span> <span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
587
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_match'>match</span>
588
+ <span class='kw'>end</span>
589
+
590
+ <span class='kw'>true</span>
591
+ <span class='kw'>end</span></pre>
592
+ </td>
593
+ </tr>
594
+ </table>
595
+ </div>
596
+
597
+ <div class="method_details ">
598
+ <h3 class="signature " id="scan_columns-instance_method">
599
+
600
+ #<strong>scan_columns</strong>(row:, columns:, matchers:) &#x21d2; <tt>Array</tt>
601
+
602
+
603
+
604
+
605
+
606
+ </h3><div class="docstring">
607
+ <div class="discussion">
608
+
609
+ <p>Scan all the specified <code>columns</code> (e.g., inputs) in the given
610
+ <code>data</code> row using the <code>matchers</code> array supplied.</p>
611
+
612
+
613
+ </div>
614
+ </div>
615
+ <div class="tags">
616
+ <p class="tag_title">Parameters:</p>
617
+ <ul class="param">
618
+
619
+ <li>
620
+
621
+ <span class='name'>row</span>
622
+
623
+
624
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
625
+
626
+
627
+
628
+ &mdash;
629
+ <div class='inline'>
630
+ <p>Data row.</p>
631
+ </div>
632
+
633
+ </li>
634
+
635
+ <li>
636
+
637
+ <span class='name'>columns</span>
638
+
639
+
640
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Columns/Entry.html" title="CSVDecision::Columns::Entry (class)">Columns::Entry</a></span>&gt;</tt>)</span>
641
+
642
+
643
+
644
+ &mdash;
645
+ <div class='inline'>
646
+ <p>Array of column dictionary entries.</p>
647
+ </div>
648
+
649
+ </li>
650
+
651
+ <li>
652
+
653
+ <span class='name'>matchers</span>
654
+
655
+
656
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt>)</span>
657
+
658
+
659
+
660
+ &mdash;
661
+ <div class='inline'>
662
+ <p>Array of table cell matchers.</p>
663
+ </div>
664
+
665
+ </li>
666
+
667
+ </ul>
668
+
669
+ <p class="tag_title">Returns:</p>
670
+ <ul class="return">
671
+
672
+ <li>
673
+
674
+
675
+ <span class='type'>(<tt>Array</tt>)</span>
676
+
677
+
678
+
679
+ &mdash;
680
+ <div class='inline'>
681
+ <p>Data row with anything not a string constant replaced with a Proc or a
682
+ non-string constant.</p>
683
+ </div>
684
+
685
+ </li>
686
+
687
+ </ul>
688
+
689
+ </div><table class="source_code">
690
+ <tr>
691
+ <td>
692
+ <pre class="lines">
693
+
694
+
695
+ 29
696
+ 30
697
+ 31
698
+ 32
699
+ 33
700
+ 34
701
+ 35
702
+ 36
703
+ 37
704
+ 38
705
+ 39
706
+ 40
707
+ 41
708
+ 42
709
+ 43</pre>
710
+ </td>
711
+ <td>
712
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 29</span>
713
+
714
+ <span class='kw'>def</span> <span class='id identifier rubyid_scan_columns'>scan_columns</span><span class='lparen'>(</span><span class='label'>row:</span><span class='comma'>,</span> <span class='label'>columns:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='rparen'>)</span>
715
+ <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='comma'>,</span> <span class='id identifier rubyid_column'>column</span><span class='op'>|</span>
716
+ <span class='comment'># Empty cell matches everything, and so never needs to be scanned
717
+ </span> <span class='kw'>next</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span> <span class='op'>=</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
718
+
719
+ <span class='comment'># If the column is text only then no special matchers need be invoked
720
+ </span> <span class='kw'>next</span> <span class='ivar'>@constants</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_col'>col</span> <span class='kw'>if</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_text_only'>text_only</span>
721
+
722
+ <span class='comment'># Need to scan the cell against all matchers, and possibly overwrite
723
+ </span> <span class='comment'># the cell contents with a proc.
724
+ </span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_scan_cell'>scan_cell</span><span class='lparen'>(</span><span class='label'>col:</span> <span class='id identifier rubyid_col'>col</span><span class='comma'>,</span> <span class='label'>matchers:</span> <span class='id identifier rubyid_matchers'>matchers</span><span class='comma'>,</span> <span class='label'>cell:</span> <span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
725
+ <span class='kw'>end</span>
726
+
727
+ <span class='id identifier rubyid_row'>row</span>
728
+ <span class='kw'>end</span></pre>
729
+ </td>
730
+ </tr>
731
+ </table>
732
+ </div>
733
+
734
+ </div>
735
+
736
+ </div>
737
+
738
+ <div id="footer">
739
+ Generated on Tue Dec 26 18:31:38 2017 by
740
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
741
+ 0.9.12 (ruby-2.3.0).
742
+ </div>
743
+
744
+ </div>
745
+ </body>
746
+ </html>