csv_decision 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +11 -8
- data/benchmarks/rufus_decision.rb +9 -1
- data/csv_decision.gemspec +1 -1
- data/doc/CSVDecision/CellValidationError.html +1 -1
- data/doc/CSVDecision/Columns/Dictionary.html +29 -29
- data/doc/CSVDecision/Columns.html +394 -47
- data/doc/CSVDecision/Data.html +2 -2
- data/doc/CSVDecision/Decide.html +23 -159
- data/doc/CSVDecision/Decision.html +370 -32
- data/doc/CSVDecision/Defaults.html +1 -1
- data/doc/CSVDecision/Dictionary/Entry.html +157 -55
- data/doc/CSVDecision/Dictionary.html +37 -21
- data/doc/CSVDecision/Error.html +1 -1
- data/doc/CSVDecision/FileError.html +1 -1
- data/doc/CSVDecision/Header.html +142 -1
- data/doc/CSVDecision/Index.html +741 -0
- data/doc/CSVDecision/Input.html +14 -61
- data/doc/CSVDecision/Load.html +1 -1
- data/doc/CSVDecision/Matchers/Constant.html +1 -1
- data/doc/CSVDecision/Matchers/Function.html +1 -1
- data/doc/CSVDecision/Matchers/Guard.html +13 -147
- data/doc/CSVDecision/Matchers/Matcher.html +13 -13
- data/doc/CSVDecision/Matchers/Numeric.html +1 -1
- data/doc/CSVDecision/Matchers/Pattern.html +1 -1
- data/doc/CSVDecision/Matchers/Proc.html +147 -14
- data/doc/CSVDecision/Matchers/Range.html +1 -1
- data/doc/CSVDecision/Matchers/Symbol.html +1 -1
- data/doc/CSVDecision/Matchers.html +55 -162
- data/doc/CSVDecision/Options.html +21 -21
- data/doc/CSVDecision/Parse.html +2 -180
- data/doc/CSVDecision/Result.html +220 -38
- data/doc/CSVDecision/ScanRow.html +69 -325
- data/doc/CSVDecision/Table.html +128 -40
- data/doc/CSVDecision/TableValidationError.html +1 -1
- data/doc/CSVDecision/Validate.html +1 -1
- data/doc/CSVDecision.html +4 -4
- data/doc/_index.html +8 -8
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +13 -11
- data/doc/index.html +13 -11
- data/doc/method_list.html +206 -150
- data/doc/top-level-namespace.html +1 -1
- data/lib/csv_decision/columns.rb +87 -1
- data/lib/csv_decision/decision.rb +54 -29
- data/lib/csv_decision/defaults.rb +1 -1
- data/lib/csv_decision/dictionary.rb +32 -22
- data/lib/csv_decision/header.rb +17 -0
- data/lib/csv_decision/index.rb +107 -0
- data/lib/csv_decision/input.rb +45 -13
- data/lib/csv_decision/matchers/guard.rb +2 -0
- data/lib/csv_decision/matchers.rb +14 -8
- data/lib/csv_decision/options.rb +7 -19
- data/lib/csv_decision/parse.rb +12 -96
- data/lib/csv_decision/result.rb +10 -9
- data/lib/csv_decision/scan_row.rb +20 -44
- data/lib/csv_decision/table.rb +7 -4
- data/lib/csv_decision.rb +1 -1
- data/spec/csv_decision/columns_spec.rb +6 -6
- data/spec/csv_decision/data_spec.rb +0 -5
- data/spec/csv_decision/index_spec.rb +58 -0
- data/spec/csv_decision/input_spec.rb +7 -2
- data/spec/csv_decision/options_spec.rb +16 -1
- data/spec/csv_decision/parse_spec.rb +4 -5
- data/spec/csv_decision/table_spec.rb +70 -0
- data/spec/data/{valid → invalid}/empty.csv +0 -0
- data/spec/data/valid/index_example.csv +12 -0
- data/spec/data/valid/multi_column_index.csv +10 -0
- data/spec/data/valid/multi_column_index2.csv +12 -0
- data/spec/data/valid/options_in_file3.csv +13 -0
- metadata +16 -5
- data/lib/csv_decision/decide.rb +0 -45
@@ -122,6 +122,39 @@
|
|
122
122
|
|
123
123
|
|
124
124
|
|
125
|
+
<h2>
|
126
|
+
Class Method Summary
|
127
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
128
|
+
</h2>
|
129
|
+
|
130
|
+
<ul class="summary">
|
131
|
+
|
132
|
+
<li class="public ">
|
133
|
+
<span class="summary_signature">
|
134
|
+
|
135
|
+
<a href="#make-class_method" title="make (class method)">.<strong>make</strong>(table:, input:, symbolize_keys:) ⇒ Hash </a>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</span>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<span class="private note title">private</span>
|
147
|
+
|
148
|
+
|
149
|
+
<span class="summary_desc"><div class='inline'>
|
150
|
+
<p>Main method for making decisions.</p>
|
151
|
+
</div></span>
|
152
|
+
|
153
|
+
</li>
|
154
|
+
|
155
|
+
|
156
|
+
</ul>
|
157
|
+
|
125
158
|
<h2>
|
126
159
|
Instance Method Summary
|
127
160
|
<small><a href="#" class="summary_toggle">collapse</a></small>
|
@@ -132,6 +165,30 @@
|
|
132
165
|
<li class="public ">
|
133
166
|
<span class="summary_signature">
|
134
167
|
|
168
|
+
<a href="#index-instance_method" title="#index (instance method)">#<strong>index</strong>(table:, input:) ⇒ {Symbol=>Object} </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<span class="private note title">private</span>
|
180
|
+
|
181
|
+
|
182
|
+
<span class="summary_desc"><div class='inline'>
|
183
|
+
<p>Use an index to scan the decision table up against the input hash.</p>
|
184
|
+
</div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
<li class="public ">
|
190
|
+
<span class="summary_signature">
|
191
|
+
|
135
192
|
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(table:, input:) ⇒ Decision </a>
|
136
193
|
|
137
194
|
|
@@ -158,7 +215,7 @@
|
|
158
215
|
<li class="public ">
|
159
216
|
<span class="summary_signature">
|
160
217
|
|
161
|
-
<a href="#scan-instance_method" title="#scan (instance method)">#<strong>scan</strong>(table:,
|
218
|
+
<a href="#scan-instance_method" title="#scan (instance method)">#<strong>scan</strong>(table:, hash:, scan_cols:) ⇒ Hash{Symbol=>Object} </a>
|
162
219
|
|
163
220
|
|
164
221
|
|
@@ -251,21 +308,21 @@
|
|
251
308
|
<pre class="lines">
|
252
309
|
|
253
310
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
311
|
+
35
|
312
|
+
36
|
313
|
+
37
|
314
|
+
38
|
315
|
+
39
|
316
|
+
40
|
317
|
+
41
|
318
|
+
42
|
319
|
+
43
|
320
|
+
44
|
321
|
+
45
|
322
|
+
46</pre>
|
266
323
|
</td>
|
267
324
|
<td>
|
268
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line
|
325
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 35</span>
|
269
326
|
|
270
327
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='rparen'>)</span>
|
271
328
|
<span class='comment'># The result object is a hash of values, and each value will be an array if this is
|
@@ -277,7 +334,7 @@
|
|
277
334
|
</span> <span class='ivar'>@rows_picked</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
278
335
|
|
279
336
|
<span class='comment'># Relevant table attributes
|
280
|
-
</span> <span class='id identifier
|
337
|
+
</span> <span class='ivar'>@first_match</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:first_match</span><span class='rbracket'>]</span>
|
281
338
|
<span class='kw'>end</span></pre>
|
282
339
|
</td>
|
283
340
|
</tr>
|
@@ -287,14 +344,158 @@
|
|
287
344
|
</div>
|
288
345
|
|
289
346
|
|
347
|
+
<div id="class_method_details" class="method_details_list">
|
348
|
+
<h2>Class Method Details</h2>
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method_details first">
|
352
|
+
<h3 class="signature first" id="make-class_method">
|
353
|
+
|
354
|
+
.<strong>make</strong>(table:, input:, symbolize_keys:) ⇒ <tt>Hash</tt>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</h3><div class="docstring">
|
361
|
+
<div class="discussion">
|
362
|
+
<p class="note private">
|
363
|
+
<strong>This method is part of a private API.</strong>
|
364
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
365
|
+
</p>
|
366
|
+
|
367
|
+
<p>Main method for making decisions.</p>
|
368
|
+
|
369
|
+
|
370
|
+
</div>
|
371
|
+
</div>
|
372
|
+
<div class="tags">
|
373
|
+
<p class="tag_title">Parameters:</p>
|
374
|
+
<ul class="param">
|
375
|
+
|
376
|
+
<li>
|
377
|
+
|
378
|
+
<span class='name'>table</span>
|
379
|
+
|
380
|
+
|
381
|
+
<span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
—
|
386
|
+
<div class='inline'>
|
387
|
+
<p>Decision table.</p>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
</li>
|
391
|
+
|
392
|
+
<li>
|
393
|
+
|
394
|
+
<span class='name'>input</span>
|
395
|
+
|
396
|
+
|
397
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
—
|
402
|
+
<div class='inline'>
|
403
|
+
<p>Input hash (keys may or may not be symbolized)</p>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
<li>
|
409
|
+
|
410
|
+
<span class='name'>symbolize_keys</span>
|
411
|
+
|
412
|
+
|
413
|
+
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
—
|
418
|
+
<div class='inline'>
|
419
|
+
<p>Set to false if keys are symbolized and it's OK to mutate the input
|
420
|
+
hash. Otherwise a copy of the input hash is symbolized.</p>
|
421
|
+
</div>
|
422
|
+
|
423
|
+
</li>
|
424
|
+
|
425
|
+
</ul>
|
426
|
+
|
427
|
+
<p class="tag_title">Returns:</p>
|
428
|
+
<ul class="return">
|
429
|
+
|
430
|
+
<li>
|
431
|
+
|
432
|
+
|
433
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
—
|
438
|
+
<div class='inline'>
|
439
|
+
<p>Decision result.</p>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
</li>
|
443
|
+
|
444
|
+
</ul>
|
445
|
+
|
446
|
+
</div><table class="source_code">
|
447
|
+
<tr>
|
448
|
+
<td>
|
449
|
+
<pre class="lines">
|
450
|
+
|
451
|
+
|
452
|
+
18
|
453
|
+
19
|
454
|
+
20
|
455
|
+
21
|
456
|
+
22
|
457
|
+
23
|
458
|
+
24
|
459
|
+
25
|
460
|
+
26
|
461
|
+
27
|
462
|
+
28
|
463
|
+
29
|
464
|
+
30
|
465
|
+
31</pre>
|
466
|
+
</td>
|
467
|
+
<td>
|
468
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 18</span>
|
469
|
+
|
470
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_make'>make</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='comma'>,</span> <span class='label'>symbolize_keys:</span><span class='rparen'>)</span>
|
471
|
+
<span class='comment'># Parse and transform the hash supplied as input
|
472
|
+
</span> <span class='id identifier rubyid_input'>input</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Input.html" title="CSVDecision::Input (module)">Input</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Input.html#parse-class_method" title="CSVDecision::Input.parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='label'>symbolize_keys:</span> <span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='rparen'>)</span>
|
473
|
+
|
474
|
+
<span class='comment'># The decision object collects the results of the search and
|
475
|
+
</span> <span class='comment'># calculates the final result
|
476
|
+
</span> <span class='id identifier rubyid_decision'>decision</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="CSVDecision::Decision (class)">Decision</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="CSVDecision::Decision#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:hash</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
477
|
+
|
478
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span>
|
479
|
+
<span class='id identifier rubyid_decision'>decision</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
|
480
|
+
<span class='kw'>else</span>
|
481
|
+
<span class='id identifier rubyid_decision'>decision</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>hash:</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:hash</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>scan_cols:</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:scan_cols</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
482
|
+
<span class='kw'>end</span>
|
483
|
+
<span class='kw'>end</span></pre>
|
484
|
+
</td>
|
485
|
+
</tr>
|
486
|
+
</table>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</div>
|
490
|
+
|
290
491
|
<div id="instance_method_details" class="method_details_list">
|
291
492
|
<h2>Instance Method Details</h2>
|
292
493
|
|
293
494
|
|
294
495
|
<div class="method_details first">
|
295
|
-
<h3 class="signature first" id="
|
496
|
+
<h3 class="signature first" id="index-instance_method">
|
296
497
|
|
297
|
-
#<strong>
|
498
|
+
#<strong>index</strong>(table:, input:) ⇒ <tt>{Symbol=>Object}</tt>
|
298
499
|
|
299
500
|
|
300
501
|
|
@@ -307,7 +508,7 @@
|
|
307
508
|
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
308
509
|
</p>
|
309
510
|
|
310
|
-
<p>
|
511
|
+
<p>Use an index to scan the decision table up against the input hash.</p>
|
311
512
|
|
312
513
|
|
313
514
|
</div>
|
@@ -316,6 +517,22 @@
|
|
316
517
|
<p class="tag_title">Parameters:</p>
|
317
518
|
<ul class="param">
|
318
519
|
|
520
|
+
<li>
|
521
|
+
|
522
|
+
<span class='name'>input</span>
|
523
|
+
|
524
|
+
|
525
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
—
|
530
|
+
<div class='inline'>
|
531
|
+
<p>Hash of parsed input data.</p>
|
532
|
+
</div>
|
533
|
+
|
534
|
+
</li>
|
535
|
+
|
319
536
|
<li>
|
320
537
|
|
321
538
|
<span class='name'>table</span>
|
@@ -375,25 +592,146 @@
|
|
375
592
|
<pre class="lines">
|
376
593
|
|
377
594
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
595
|
+
68
|
596
|
+
69
|
597
|
+
70
|
598
|
+
71
|
599
|
+
72
|
600
|
+
73</pre>
|
601
|
+
</td>
|
602
|
+
<td>
|
603
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 68</span>
|
604
|
+
|
605
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='rparen'>)</span>
|
606
|
+
<span class='comment'># If the index lookup fails, there's no match
|
607
|
+
</span> <span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_rows'>rows</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
608
|
+
|
609
|
+
<span class='id identifier rubyid_index_scan'>index_scan</span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>scan_cols:</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:scan_cols</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>hash:</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:hash</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>rows:</span> <span class='id identifier rubyid_rows'>rows</span><span class='rparen'>)</span>
|
610
|
+
<span class='kw'>end</span></pre>
|
611
|
+
</td>
|
612
|
+
</tr>
|
613
|
+
</table>
|
614
|
+
</div>
|
615
|
+
|
616
|
+
<div class="method_details ">
|
617
|
+
<h3 class="signature " id="scan-instance_method">
|
618
|
+
|
619
|
+
#<strong>scan</strong>(table:, hash:, scan_cols:) ⇒ <tt>Hash{Symbol=>Object}</tt>
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
</h3><div class="docstring">
|
626
|
+
<div class="discussion">
|
627
|
+
<p class="note private">
|
628
|
+
<strong>This method is part of a private API.</strong>
|
629
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
630
|
+
</p>
|
631
|
+
|
632
|
+
<p>Scan the decision table up against the input hash.</p>
|
633
|
+
|
634
|
+
|
635
|
+
</div>
|
636
|
+
</div>
|
637
|
+
<div class="tags">
|
638
|
+
<p class="tag_title">Parameters:</p>
|
639
|
+
<ul class="param">
|
640
|
+
|
641
|
+
<li>
|
642
|
+
|
643
|
+
<span class='name'>hash</span>
|
644
|
+
|
645
|
+
|
646
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
—
|
651
|
+
<div class='inline'>
|
652
|
+
<p>Input hash.</p>
|
653
|
+
</div>
|
654
|
+
|
655
|
+
</li>
|
656
|
+
|
657
|
+
<li>
|
658
|
+
|
659
|
+
<span class='name'>scan_cols</span>
|
660
|
+
|
661
|
+
|
662
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="Index.html" title="CSVDecision::Index (class)">Index</a></span>=>Object}</tt>)</span>
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
—
|
667
|
+
<div class='inline'>
|
668
|
+
<p>Input column values to scan.</p>
|
669
|
+
</div>
|
670
|
+
|
671
|
+
</li>
|
672
|
+
|
673
|
+
<li>
|
674
|
+
|
675
|
+
<span class='name'>table</span>
|
676
|
+
|
677
|
+
|
678
|
+
<span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
—
|
683
|
+
<div class='inline'>
|
684
|
+
<p>Decision table being processed.</p>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
</li>
|
688
|
+
|
689
|
+
</ul>
|
690
|
+
|
691
|
+
<p class="tag_title">Returns:</p>
|
692
|
+
<ul class="return">
|
693
|
+
|
694
|
+
<li>
|
695
|
+
|
696
|
+
|
697
|
+
<span class='type'>(<tt>Hash{Symbol=>Object}</tt>)</span>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
—
|
702
|
+
<div class='inline'>
|
703
|
+
<p>Decision result.</p>
|
704
|
+
</div>
|
705
|
+
|
706
|
+
</li>
|
707
|
+
|
708
|
+
</ul>
|
709
|
+
|
710
|
+
</div><table class="source_code">
|
711
|
+
<tr>
|
712
|
+
<td>
|
713
|
+
<pre class="lines">
|
714
|
+
|
715
|
+
|
716
|
+
54
|
717
|
+
55
|
718
|
+
56
|
719
|
+
57
|
720
|
+
58
|
721
|
+
59
|
722
|
+
60
|
723
|
+
61</pre>
|
386
724
|
</td>
|
387
725
|
<td>
|
388
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line
|
726
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 54</span>
|
389
727
|
|
390
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>
|
728
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>hash:</span><span class='comma'>,</span> <span class='label'>scan_cols:</span><span class='rparen'>)</span>
|
391
729
|
<span class='id identifier rubyid_table'>table</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_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
392
|
-
<span class='
|
393
|
-
|
730
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_scan_rows'>scan_rows</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='label'>hash:</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='label'>scan_cols:</span> <span class='id identifier rubyid_scan_cols'>scan_cols</span><span class='rparen'>)</span>
|
731
|
+
<span class='kw'>return</span> <span class='ivar'>@result</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='kw'>if</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
394
732
|
<span class='kw'>end</span>
|
395
733
|
|
396
|
-
<span class='id identifier
|
734
|
+
<span class='ivar'>@rows_picked</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='id identifier rubyid_accumulated_result'>accumulated_result</span>
|
397
735
|
<span class='kw'>end</span></pre>
|
398
736
|
</td>
|
399
737
|
</tr>
|
@@ -405,7 +743,7 @@
|
|
405
743
|
</div>
|
406
744
|
|
407
745
|
<div id="footer">
|
408
|
-
Generated on Sat Jan
|
746
|
+
Generated on Sat Jan 20 15:44:35 2018 by
|
409
747
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
410
748
|
0.9.12 (ruby-2.4.0).
|
411
749
|
</div>
|
@@ -281,7 +281,7 @@ We have already determined that this row must be present.</p>
|
|
281
281
|
</div>
|
282
282
|
|
283
283
|
<div id="footer">
|
284
|
-
Generated on Sat Jan
|
284
|
+
Generated on Sat Jan 20 15:44:34 2018 by
|
285
285
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
286
286
|
0.9.12 (ruby-2.4.0).
|
287
287
|
</div>
|