csv_decision 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/doc/CSVDecision/Header.html
CHANGED
@@ -184,6 +184,30 @@ method name - note any spaces will have been replaced with underscores.</p>
|
|
184
184
|
<p>Return true if column name is valid.</p>
|
185
185
|
</div></span>
|
186
186
|
|
187
|
+
</li>
|
188
|
+
|
189
|
+
|
190
|
+
<li class="public ">
|
191
|
+
<span class="summary_signature">
|
192
|
+
|
193
|
+
<a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(table:, matchers:) ⇒ CSVDecision::Columns </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>Parse the header row, and the defaults row if present.</p>
|
209
|
+
</div></span>
|
210
|
+
|
187
211
|
</li>
|
188
212
|
|
189
213
|
|
@@ -315,6 +339,123 @@ method name - note any spaces will have been replaced with underscores.</p>
|
|
315
339
|
</td>
|
316
340
|
</tr>
|
317
341
|
</table>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div class="method_details ">
|
345
|
+
<h3 class="signature " id="parse-class_method">
|
346
|
+
|
347
|
+
.<strong>parse</strong>(table:, matchers:) ⇒ <tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</h3><div class="docstring">
|
354
|
+
<div class="discussion">
|
355
|
+
<p class="note private">
|
356
|
+
<strong>This method is part of a private API.</strong>
|
357
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
358
|
+
</p>
|
359
|
+
|
360
|
+
<p>Parse the header row, and the defaults row if present.</p>
|
361
|
+
|
362
|
+
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
<div class="tags">
|
366
|
+
<p class="tag_title">Parameters:</p>
|
367
|
+
<ul class="param">
|
368
|
+
|
369
|
+
<li>
|
370
|
+
|
371
|
+
<span class='name'>table</span>
|
372
|
+
|
373
|
+
|
374
|
+
<span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
—
|
379
|
+
<div class='inline'>
|
380
|
+
<p>Decision table being parsed.</p>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
</li>
|
384
|
+
|
385
|
+
<li>
|
386
|
+
|
387
|
+
<span class='name'>matchers</span>
|
388
|
+
|
389
|
+
|
390
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>></tt>)</span>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
—
|
395
|
+
<div class='inline'>
|
396
|
+
<p>Array of special cell matchers.</p>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
</li>
|
400
|
+
|
401
|
+
</ul>
|
402
|
+
|
403
|
+
<p class="tag_title">Returns:</p>
|
404
|
+
<ul class="return">
|
405
|
+
|
406
|
+
<li>
|
407
|
+
|
408
|
+
|
409
|
+
<span class='type'>(<tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>)</span>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
—
|
414
|
+
<div class='inline'>
|
415
|
+
<p>Table columns object.</p>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
</li>
|
419
|
+
|
420
|
+
</ul>
|
421
|
+
|
422
|
+
</div><table class="source_code">
|
423
|
+
<tr>
|
424
|
+
<td>
|
425
|
+
<pre class="lines">
|
426
|
+
|
427
|
+
|
428
|
+
59
|
429
|
+
60
|
430
|
+
61
|
431
|
+
62
|
432
|
+
63
|
433
|
+
64
|
434
|
+
65
|
435
|
+
66
|
436
|
+
67
|
437
|
+
68
|
438
|
+
69
|
439
|
+
70</pre>
|
440
|
+
</td>
|
441
|
+
<td>
|
442
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 59</span>
|
443
|
+
|
444
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='rparen'>)</span>
|
445
|
+
<span class='comment'># Parse the header row
|
446
|
+
</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">Columns</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Columns.html#initialize-instance_method" title="CSVDecision::Columns#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='rparen'>)</span>
|
447
|
+
|
448
|
+
<span class='comment'># Parse the defaults row if present
|
449
|
+
</span> <span class='kw'>return</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span> <span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_defaults'>defaults</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
450
|
+
|
451
|
+
<span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_defaults'>defaults</span> <span class='op'>=</span>
|
452
|
+
<span class='const'><span class='object_link'><a href="Defaults.html" title="CSVDecision::Defaults (module)">Defaults</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Defaults.html#parse-class_method" title="CSVDecision::Defaults.parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='label'>columns:</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='label'>matchers:</span> <span class='id identifier rubyid_matchers'>matchers</span><span class='period'>.</span><span class='id identifier rubyid_outs'>outs</span><span class='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span><span class='rparen'>)</span>
|
453
|
+
|
454
|
+
<span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span>
|
455
|
+
<span class='kw'>end</span></pre>
|
456
|
+
</td>
|
457
|
+
</tr>
|
458
|
+
</table>
|
318
459
|
</div>
|
319
460
|
|
320
461
|
<div class="method_details ">
|
@@ -496,7 +637,7 @@ method name - note any spaces will have been replaced with underscores.</p>
|
|
496
637
|
</div>
|
497
638
|
|
498
639
|
<div id="footer">
|
499
|
-
Generated on Sat Jan
|
640
|
+
Generated on Sat Jan 20 15:44:34 2018 by
|
500
641
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
501
642
|
0.9.12 (ruby-2.4.0).
|
502
643
|
</div>
|