csv_decision 0.1.0 → 0.2.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +26 -2
  4. data/csv_decision.gemspec +1 -1
  5. data/doc/CSVDecision/CellValidationError.html +2 -2
  6. data/doc/CSVDecision/Columns/Default.html +203 -23
  7. data/doc/CSVDecision/Columns/Dictionary.html +118 -25
  8. data/doc/CSVDecision/Columns.html +213 -31
  9. data/doc/CSVDecision/Data.html +1 -1
  10. data/doc/CSVDecision/Decide.html +1 -1
  11. data/doc/CSVDecision/Decision.html +1 -1
  12. data/doc/CSVDecision/Defaults.html +291 -0
  13. data/doc/CSVDecision/Dictionary/Entry.html +584 -47
  14. data/doc/CSVDecision/Dictionary.html +20 -20
  15. data/doc/CSVDecision/Error.html +2 -2
  16. data/doc/CSVDecision/FileError.html +1 -1
  17. data/doc/CSVDecision/Header.html +110 -33
  18. data/doc/CSVDecision/Input.html +1 -1
  19. data/doc/CSVDecision/Load.html +1 -1
  20. data/doc/CSVDecision/Matchers/Constant.html +12 -37
  21. data/doc/CSVDecision/Matchers/Function.html +1 -1
  22. data/doc/CSVDecision/Matchers/Guard.html +15 -13
  23. data/doc/CSVDecision/Matchers/Matcher.html +1 -1
  24. data/doc/CSVDecision/Matchers/Numeric.html +13 -21
  25. data/doc/CSVDecision/Matchers/Pattern.html +14 -14
  26. data/doc/CSVDecision/Matchers/Proc.html +1 -1
  27. data/doc/CSVDecision/Matchers/Range.html +13 -58
  28. data/doc/CSVDecision/Matchers/Symbol.html +1 -1
  29. data/doc/CSVDecision/Matchers.html +9 -9
  30. data/doc/CSVDecision/Options.html +1 -1
  31. data/doc/CSVDecision/Parse.html +90 -19
  32. data/doc/CSVDecision/Result.html +1 -1
  33. data/doc/CSVDecision/ScanRow.html +17 -17
  34. data/doc/CSVDecision/Table.html +50 -48
  35. data/doc/CSVDecision/TableValidationError.html +143 -0
  36. data/doc/CSVDecision/Validate.html +422 -0
  37. data/doc/CSVDecision.html +8 -8
  38. data/doc/_index.html +33 -1
  39. data/doc/class_list.html +1 -1
  40. data/doc/file.README.html +27 -3
  41. data/doc/index.html +27 -3
  42. data/doc/method_list.html +193 -89
  43. data/doc/top-level-namespace.html +1 -1
  44. data/lib/csv_decision/columns.rb +28 -27
  45. data/lib/csv_decision/defaults.rb +47 -0
  46. data/lib/csv_decision/dictionary.rb +104 -112
  47. data/lib/csv_decision/header.rb +13 -10
  48. data/lib/csv_decision/input.rb +53 -5
  49. data/lib/csv_decision/matchers/constant.rb +1 -2
  50. data/lib/csv_decision/matchers/guard.rb +3 -2
  51. data/lib/csv_decision/matchers/numeric.rb +4 -6
  52. data/lib/csv_decision/matchers/pattern.rb +6 -8
  53. data/lib/csv_decision/matchers/range.rb +1 -3
  54. data/lib/csv_decision/matchers.rb +7 -7
  55. data/lib/csv_decision/parse.rb +24 -3
  56. data/lib/csv_decision/scan_row.rb +16 -16
  57. data/lib/csv_decision/table.rb +3 -7
  58. data/lib/csv_decision/validate.rb +85 -0
  59. data/lib/csv_decision.rb +3 -1
  60. data/spec/csv_decision/columns_spec.rb +38 -22
  61. data/spec/csv_decision/examples_spec.rb +17 -0
  62. data/spec/csv_decision/matchers/range_spec.rb +0 -32
  63. data/spec/csv_decision/table_spec.rb +39 -0
  64. metadata +7 -2
@@ -142,7 +142,7 @@
142
142
  <li class="public ">
143
143
  <span class="summary_signature">
144
144
 
145
- <a href="#dictionary-instance_method" title="#dictionary (instance method)">#<strong>dictionary</strong> &#x21d2; Object </a>
145
+ <a href="#defaults-instance_method" title="#defaults (instance method)">#<strong>defaults</strong> &#x21d2; Object </a>
146
146
 
147
147
 
148
148
 
@@ -156,7 +156,57 @@
156
156
  <span class="private note title">private</span>
157
157
 
158
158
 
159
- <span class="summary_desc"><div class='inline'></div></span>
159
+ <span class="summary_desc"><div class='inline'>
160
+ <p>Input columns with defaults specified.</p>
161
+ </div></span>
162
+
163
+ </li>
164
+
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#defaults=-instance_method" title="#defaults= (instance method)">#<strong>defaults=</strong>(value) &#x21d2; Object </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="private note title">private</span>
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'>
184
+ <p>Set defaults for columns with defaults specified.</p>
185
+ </div></span>
186
+
187
+ </li>
188
+
189
+
190
+ <li class="public ">
191
+ <span class="summary_signature">
192
+
193
+ <a href="#dictionary-instance_method" title="#dictionary (instance method)">#<strong>dictionary</strong> &#x21d2; Hash{Symbol=&gt;[false, Integer]} </a>
194
+
195
+
196
+
197
+ </span>
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="private note title">private</span>
205
+
206
+
207
+ <span class="summary_desc"><div class='inline'>
208
+ <p>Dictionary of all input and output column names.</p>
209
+ </div></span>
160
210
 
161
211
  </li>
162
212
 
@@ -214,7 +264,7 @@
214
264
  <li class="public ">
215
265
  <span class="summary_signature">
216
266
 
217
- <a href="#input_keys-instance_method" title="#input_keys (instance method)">#<strong>input_keys</strong> &#x21d2; Object </a>
267
+ <a href="#input_keys-instance_method" title="#input_keys (instance method)">#<strong>input_keys</strong> &#x21d2; Array&lt;Symbol&gt; </a>
218
268
 
219
269
 
220
270
 
@@ -228,7 +278,9 @@
228
278
  <span class="private note title">private</span>
229
279
 
230
280
 
231
- <span class="summary_desc"><div class='inline'></div></span>
281
+ <span class="summary_desc"><div class='inline'>
282
+ <p>All input column symbols.</p>
283
+ </div></span>
232
284
 
233
285
  </li>
234
286
 
@@ -337,7 +389,6 @@
337
389
  <pre class="lines">
338
390
 
339
391
 
340
- 83
341
392
  84
342
393
  85
343
394
  86
@@ -346,10 +397,11 @@
346
397
  89
347
398
  90
348
399
  91
349
- 92</pre>
400
+ 92
401
+ 93</pre>
350
402
  </td>
351
403
  <td>
352
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 83</span>
404
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 84</span>
353
405
 
354
406
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='rparen'>)</span>
355
407
  <span class='comment'># If a column does not have a valid header cell, then it&#39;s empty of data.
@@ -374,9 +426,54 @@
374
426
 
375
427
 
376
428
  <div class="method_details first">
377
- <h3 class="signature first" id="dictionary-instance_method">
429
+ <h3 class="signature first" id="defaults-instance_method">
430
+
431
+ #<strong>defaults</strong> &#x21d2; <tt>Object</tt>
432
+
433
+
434
+
435
+
436
+
437
+ </h3><div class="docstring">
438
+ <div class="discussion">
439
+ <p class="note private">
440
+ <strong>This method is part of a private API.</strong>
441
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
442
+ </p>
443
+
444
+ <p>Input columns with defaults specified</p>
445
+
446
+
447
+ </div>
448
+ </div>
449
+ <div class="tags">
450
+
451
+
452
+ </div><table class="source_code">
453
+ <tr>
454
+ <td>
455
+ <pre class="lines">
456
+
457
+
458
+ 45
459
+ 46
460
+ 47</pre>
461
+ </td>
462
+ <td>
463
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 45</span>
464
+
465
+ <span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span>
466
+ <span class='ivar'>@dictionary</span><span class='op'>&amp;.</span><span class='id identifier rubyid_defaults'>defaults</span>
467
+ <span class='kw'>end</span></pre>
468
+ </td>
469
+ </tr>
470
+ </table>
471
+ </div>
472
+
473
+ <div class="method_details ">
474
+ <h3 class="signature " id="defaults=-instance_method">
378
475
 
379
- #<strong>dictionary</strong> &#x21d2; <tt>Object</tt>
476
+ #<strong>defaults=</strong>(value) &#x21d2; <tt>Object</tt>
380
477
 
381
478
 
382
479
 
@@ -389,6 +486,8 @@
389
486
  You should avoid using this method if possible, as it may be removed or be changed in the future.
390
487
  </p>
391
488
 
489
+ <p>Set defaults for columns with defaults specified</p>
490
+
392
491
 
393
492
  </div>
394
493
  </div>
@@ -401,12 +500,75 @@
401
500
  <pre class="lines">
402
501
 
403
502
 
404
- 64
405
- 65
406
- 66</pre>
503
+ 50
504
+ 51
505
+ 52</pre>
407
506
  </td>
408
507
  <td>
409
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 64</span>
508
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 50</span>
509
+
510
+ <span class='kw'>def</span> <span class='id identifier rubyid_defaults='>defaults=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
511
+ <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_defaults'>defaults</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
512
+ <span class='kw'>end</span></pre>
513
+ </td>
514
+ </tr>
515
+ </table>
516
+ </div>
517
+
518
+ <div class="method_details ">
519
+ <h3 class="signature " id="dictionary-instance_method">
520
+
521
+ #<strong>dictionary</strong> &#x21d2; <tt>Hash{Symbol=&gt;[false, Integer]}</tt>
522
+
523
+
524
+
525
+
526
+
527
+ </h3><div class="docstring">
528
+ <div class="discussion">
529
+ <p class="note private">
530
+ <strong>This method is part of a private API.</strong>
531
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
532
+ </p>
533
+
534
+ <p>Returns Dictionary of all input and output column names.</p>
535
+
536
+
537
+ </div>
538
+ </div>
539
+ <div class="tags">
540
+
541
+ <p class="tag_title">Returns:</p>
542
+ <ul class="return">
543
+
544
+ <li>
545
+
546
+
547
+ <span class='type'>(<tt>Hash{Symbol=&gt;[false, Integer]}</tt>)</span>
548
+
549
+
550
+
551
+ &mdash;
552
+ <div class='inline'>
553
+ <p>Dictionary of all input and output column names.</p>
554
+ </div>
555
+
556
+ </li>
557
+
558
+ </ul>
559
+
560
+ </div><table class="source_code">
561
+ <tr>
562
+ <td>
563
+ <pre class="lines">
564
+
565
+
566
+ 56
567
+ 57
568
+ 58</pre>
569
+ </td>
570
+ <td>
571
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 56</span>
410
572
 
411
573
  <span class='kw'>def</span> <span class='id identifier rubyid_dictionary'>dictionary</span>
412
574
  <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span>
@@ -459,12 +621,12 @@
459
621
  <pre class="lines">
460
622
 
461
623
 
462
- 60
463
- 61
464
- 62</pre>
624
+ 74
625
+ 75
626
+ 76</pre>
465
627
  </td>
466
628
  <td>
467
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 60</span>
629
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 74</span>
468
630
 
469
631
  <span class='kw'>def</span> <span class='id identifier rubyid_ifs'>ifs</span>
470
632
  <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_ifs'>ifs</span>
@@ -477,7 +639,7 @@
477
639
  <div class="method_details ">
478
640
  <h3 class="signature " id="input_keys-instance_method">
479
641
 
480
- #<strong>input_keys</strong> &#x21d2; <tt>Object</tt>
642
+ #<strong>input_keys</strong> &#x21d2; <tt>Array&lt;Symbol&gt;</tt>
481
643
 
482
644
 
483
645
 
@@ -490,11 +652,31 @@
490
652
  You should avoid using this method if possible, as it may be removed or be changed in the future.
491
653
  </p>
492
654
 
655
+ <p>Returns All input column symbols.</p>
656
+
493
657
 
494
658
  </div>
495
659
  </div>
496
660
  <div class="tags">
497
661
 
662
+ <p class="tag_title">Returns:</p>
663
+ <ul class="return">
664
+
665
+ <li>
666
+
667
+
668
+ <span class='type'>(<tt>Array&lt;Symbol&gt;</tt>)</span>
669
+
670
+
671
+
672
+ &mdash;
673
+ <div class='inline'>
674
+ <p>All input column symbols.</p>
675
+ </div>
676
+
677
+ </li>
678
+
679
+ </ul>
498
680
 
499
681
  </div><table class="source_code">
500
682
  <tr>
@@ -502,12 +684,12 @@
502
684
  <pre class="lines">
503
685
 
504
686
 
505
- 68
506
- 69
507
- 70</pre>
687
+ 79
688
+ 80
689
+ 81</pre>
508
690
  </td>
509
691
  <td>
510
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 68</span>
692
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 79</span>
511
693
 
512
694
  <span class='kw'>def</span> <span class='id identifier rubyid_input_keys'>input_keys</span>
513
695
  <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__k'>_k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>==</span> <span class='symbol'>:in</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
@@ -560,12 +742,12 @@
560
742
  <pre class="lines">
561
743
 
562
744
 
563
- 48
564
- 49
565
- 50</pre>
745
+ 62
746
+ 63
747
+ 64</pre>
566
748
  </td>
567
749
  <td>
568
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 48</span>
750
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 62</span>
569
751
 
570
752
  <span class='kw'>def</span> <span class='id identifier rubyid_ins'>ins</span>
571
753
  <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_ins'>ins</span>
@@ -618,12 +800,12 @@
618
800
  <pre class="lines">
619
801
 
620
802
 
621
- 54
622
- 55
623
- 56</pre>
803
+ 68
804
+ 69
805
+ 70</pre>
624
806
  </td>
625
807
  <td>
626
- <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 54</span>
808
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 68</span>
627
809
 
628
810
  <span class='kw'>def</span> <span class='id identifier rubyid_outs'>outs</span>
629
811
  <span class='ivar'>@dictionary</span><span class='op'>&amp;.</span><span class='id identifier rubyid_outs'>outs</span>
@@ -638,7 +820,7 @@
638
820
  </div>
639
821
 
640
822
  <div id="footer">
641
- Generated on Sat Jan 6 20:03:02 2018 by
823
+ Generated on Sat Jan 13 10:02:46 2018 by
642
824
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
643
825
  0.9.12 (ruby-2.4.0).
644
826
  </div>
@@ -469,7 +469,7 @@ array of arrays. Strips out empty columns/rows and comment cells.</p>
469
469
  </div>
470
470
 
471
471
  <div id="footer">
472
- Generated on Sat Jan 6 20:03:01 2018 by
472
+ Generated on Sat Jan 13 10:02:46 2018 by
473
473
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
474
474
  0.9.12 (ruby-2.4.0).
475
475
  </div>
@@ -428,7 +428,7 @@ hash. Otherwise a copy of the input hash is symbolized.</p>
428
428
  </div>
429
429
 
430
430
  <div id="footer">
431
- Generated on Sat Jan 6 20:03:01 2018 by
431
+ Generated on Sat Jan 13 10:02:46 2018 by
432
432
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
433
433
  0.9.12 (ruby-2.4.0).
434
434
  </div>
@@ -405,7 +405,7 @@
405
405
  </div>
406
406
 
407
407
  <div id="footer">
408
- Generated on Sat Jan 6 20:03:02 2018 by
408
+ Generated on Sat Jan 13 10:02:47 2018 by
409
409
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
410
410
  0.9.12 (ruby-2.4.0).
411
411
  </div>