csv_decision2 0.5.1

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 (134) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +3 -0
  3. data/.coveralls.yml +2 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +30 -0
  7. data/.travis.yml +6 -0
  8. data/CHANGELOG.md +85 -0
  9. data/Dockerfile +6 -0
  10. data/Gemfile +7 -0
  11. data/LICENSE +21 -0
  12. data/README.md +356 -0
  13. data/benchmarks/rufus_decision.rb +158 -0
  14. data/csv_decision2.gemspec +38 -0
  15. data/doc/CSVDecision/CellValidationError.html +143 -0
  16. data/doc/CSVDecision/Columns/Default.html +589 -0
  17. data/doc/CSVDecision/Columns/Dictionary.html +801 -0
  18. data/doc/CSVDecision/Columns/Entry.html +508 -0
  19. data/doc/CSVDecision/Columns.html +1259 -0
  20. data/doc/CSVDecision/Constant.html +254 -0
  21. data/doc/CSVDecision/Data.html +479 -0
  22. data/doc/CSVDecision/Decide.html +302 -0
  23. data/doc/CSVDecision/Decision.html +1011 -0
  24. data/doc/CSVDecision/Defaults.html +291 -0
  25. data/doc/CSVDecision/Dictionary/Entry.html +1147 -0
  26. data/doc/CSVDecision/Dictionary.html +426 -0
  27. data/doc/CSVDecision/Error.html +139 -0
  28. data/doc/CSVDecision/FileError.html +143 -0
  29. data/doc/CSVDecision/Function.html +240 -0
  30. data/doc/CSVDecision/Guard.html +245 -0
  31. data/doc/CSVDecision/Header.html +647 -0
  32. data/doc/CSVDecision/Index.html +741 -0
  33. data/doc/CSVDecision/Input.html +404 -0
  34. data/doc/CSVDecision/Load.html +296 -0
  35. data/doc/CSVDecision/Matchers/Constant.html +484 -0
  36. data/doc/CSVDecision/Matchers/Function.html +511 -0
  37. data/doc/CSVDecision/Matchers/Guard.html +503 -0
  38. data/doc/CSVDecision/Matchers/Matcher.html +507 -0
  39. data/doc/CSVDecision/Matchers/Numeric.html +415 -0
  40. data/doc/CSVDecision/Matchers/Pattern.html +491 -0
  41. data/doc/CSVDecision/Matchers/Proc.html +704 -0
  42. data/doc/CSVDecision/Matchers/Range.html +379 -0
  43. data/doc/CSVDecision/Matchers/Symbol.html +426 -0
  44. data/doc/CSVDecision/Matchers.html +1567 -0
  45. data/doc/CSVDecision/Numeric.html +259 -0
  46. data/doc/CSVDecision/Options.html +443 -0
  47. data/doc/CSVDecision/Parse.html +282 -0
  48. data/doc/CSVDecision/Paths.html +742 -0
  49. data/doc/CSVDecision/Result.html +1200 -0
  50. data/doc/CSVDecision/Scan/InputHashes.html +369 -0
  51. data/doc/CSVDecision/Scan.html +313 -0
  52. data/doc/CSVDecision/ScanRow.html +866 -0
  53. data/doc/CSVDecision/Symbol.html +256 -0
  54. data/doc/CSVDecision/Table.html +1470 -0
  55. data/doc/CSVDecision/TableValidationError.html +143 -0
  56. data/doc/CSVDecision/Validate.html +422 -0
  57. data/doc/CSVDecision.html +621 -0
  58. data/doc/_index.html +471 -0
  59. data/doc/class_list.html +51 -0
  60. data/doc/css/common.css +1 -0
  61. data/doc/css/full_list.css +58 -0
  62. data/doc/css/style.css +499 -0
  63. data/doc/file.README.html +421 -0
  64. data/doc/file_list.html +56 -0
  65. data/doc/frames.html +17 -0
  66. data/doc/index.html +421 -0
  67. data/doc/js/app.js +248 -0
  68. data/doc/js/full_list.js +216 -0
  69. data/doc/js/jquery.js +4 -0
  70. data/doc/method_list.html +1163 -0
  71. data/doc/top-level-namespace.html +110 -0
  72. data/docker-compose.yml +13 -0
  73. data/lib/csv_decision/columns.rb +192 -0
  74. data/lib/csv_decision/data.rb +92 -0
  75. data/lib/csv_decision/decision.rb +196 -0
  76. data/lib/csv_decision/defaults.rb +47 -0
  77. data/lib/csv_decision/dictionary.rb +180 -0
  78. data/lib/csv_decision/header.rb +83 -0
  79. data/lib/csv_decision/index.rb +107 -0
  80. data/lib/csv_decision/input.rb +121 -0
  81. data/lib/csv_decision/load.rb +36 -0
  82. data/lib/csv_decision/matchers/constant.rb +74 -0
  83. data/lib/csv_decision/matchers/function.rb +56 -0
  84. data/lib/csv_decision/matchers/guard.rb +142 -0
  85. data/lib/csv_decision/matchers/numeric.rb +44 -0
  86. data/lib/csv_decision/matchers/pattern.rb +94 -0
  87. data/lib/csv_decision/matchers/range.rb +95 -0
  88. data/lib/csv_decision/matchers/symbol.rb +149 -0
  89. data/lib/csv_decision/matchers.rb +220 -0
  90. data/lib/csv_decision/options.rb +124 -0
  91. data/lib/csv_decision/parse.rb +165 -0
  92. data/lib/csv_decision/paths.rb +78 -0
  93. data/lib/csv_decision/result.rb +204 -0
  94. data/lib/csv_decision/scan.rb +117 -0
  95. data/lib/csv_decision/scan_row.rb +142 -0
  96. data/lib/csv_decision/table.rb +101 -0
  97. data/lib/csv_decision/validate.rb +85 -0
  98. data/lib/csv_decision.rb +45 -0
  99. data/spec/csv_decision/columns_spec.rb +251 -0
  100. data/spec/csv_decision/constant_spec.rb +36 -0
  101. data/spec/csv_decision/data_spec.rb +50 -0
  102. data/spec/csv_decision/decision_spec.rb +19 -0
  103. data/spec/csv_decision/examples_spec.rb +242 -0
  104. data/spec/csv_decision/index_spec.rb +58 -0
  105. data/spec/csv_decision/input_spec.rb +55 -0
  106. data/spec/csv_decision/load_spec.rb +28 -0
  107. data/spec/csv_decision/matchers/function_spec.rb +82 -0
  108. data/spec/csv_decision/matchers/guard_spec.rb +170 -0
  109. data/spec/csv_decision/matchers/numeric_spec.rb +47 -0
  110. data/spec/csv_decision/matchers/pattern_spec.rb +183 -0
  111. data/spec/csv_decision/matchers/range_spec.rb +70 -0
  112. data/spec/csv_decision/matchers/symbol_spec.rb +67 -0
  113. data/spec/csv_decision/options_spec.rb +94 -0
  114. data/spec/csv_decision/parse_spec.rb +44 -0
  115. data/spec/csv_decision/table_spec.rb +683 -0
  116. data/spec/csv_decision_spec.rb +7 -0
  117. data/spec/data/invalid/empty.csv +0 -0
  118. data/spec/data/invalid/invalid_header1.csv +4 -0
  119. data/spec/data/invalid/invalid_header2.csv +4 -0
  120. data/spec/data/invalid/invalid_header3.csv +4 -0
  121. data/spec/data/invalid/invalid_header4.csv +4 -0
  122. data/spec/data/valid/benchmark_regexp.csv +10 -0
  123. data/spec/data/valid/index_example.csv +13 -0
  124. data/spec/data/valid/multi_column_index.csv +10 -0
  125. data/spec/data/valid/multi_column_index2.csv +12 -0
  126. data/spec/data/valid/options_in_file1.csv +5 -0
  127. data/spec/data/valid/options_in_file2.csv +5 -0
  128. data/spec/data/valid/options_in_file3.csv +13 -0
  129. data/spec/data/valid/regular_expressions.csv +11 -0
  130. data/spec/data/valid/simple_constants.csv +5 -0
  131. data/spec/data/valid/simple_example.csv +10 -0
  132. data/spec/data/valid/valid.csv +4 -0
  133. data/spec/spec_helper.rb +106 -0
  134. metadata +352 -0
@@ -0,0 +1,1200 @@
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::Result
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::Result";
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="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span>
41
+ &raquo;
42
+ <span class="title">Result</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::Result
63
+
64
+
65
+ <span class="private note title">Private</span>
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::Result</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/result.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p class="note private">
105
+ <strong>This class is part of a private API.</strong>
106
+ You should avoid using this class if possible, as it may be removed or be changed in the future.
107
+ </p>
108
+
109
+ <p>Accumulate the matching row(s) into a result hash.</p>
110
+
111
+
112
+ </div>
113
+ </div>
114
+ <div class="tags">
115
+
116
+
117
+ </div>
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
122
+ <ul class="summary">
123
+
124
+ <li class="public ">
125
+ <span class="summary_signature">
126
+
127
+ <a href="#attributes-instance_method" title="#attributes (instance method)">#<strong>attributes</strong> &#x21d2; Hash{Symbol=&gt;Object}, Hash{Integer=&gt;Object} </a>
128
+
129
+
130
+
131
+ </span>
132
+
133
+
134
+
135
+
136
+ <span class="note title readonly">readonly</span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <span class="private note title">private</span>
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>The decision result hash containing both result values and if: columns,
148
+ which eventually get evaluated and removed.</p>
149
+ </div></span>
150
+
151
+ </li>
152
+
153
+
154
+ <li class="public ">
155
+ <span class="summary_signature">
156
+
157
+ <a href="#multi_result-instance_method" title="#multi_result (instance method)">#<strong>multi_result</strong> &#x21d2; Boolean </a>
158
+
159
+
160
+
161
+ </span>
162
+
163
+
164
+
165
+
166
+ <span class="note title readonly">readonly</span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span class="private note title">private</span>
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'>
177
+ <p>Returns true if this is a multi-row result.</p>
178
+ </div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#outs-instance_method" title="#outs (instance method)">#<strong>outs</strong> &#x21d2; Hash{Index=&gt;Dictionary::Entry} </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+ <span class="note title readonly">readonly</span>
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="private note title">private</span>
203
+
204
+
205
+ <span class="summary_desc"><div class='inline'>
206
+ <p>Output columns.</p>
207
+ </div></span>
208
+
209
+ </li>
210
+
211
+
212
+ <li class="public ">
213
+ <span class="summary_signature">
214
+
215
+ <a href="#outs_functions-instance_method" title="#outs_functions (instance method)">#<strong>outs_functions</strong> &#x21d2; nil, true </a>
216
+
217
+
218
+
219
+ </span>
220
+
221
+
222
+
223
+
224
+ <span class="note title readonly">readonly</span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="private note title">private</span>
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'>
235
+ <p>Set to true if the table has output functions.</p>
236
+ </div></span>
237
+
238
+ </li>
239
+
240
+
241
+ </ul>
242
+
243
+
244
+
245
+
246
+
247
+ <h2>
248
+ Instance Method Summary
249
+ <small><a href="#" class="summary_toggle">collapse</a></small>
250
+ </h2>
251
+
252
+ <ul class="summary">
253
+
254
+ <li class="public ">
255
+ <span class="summary_signature">
256
+
257
+ <a href="#accumulate_outs-instance_method" title="#accumulate_outs (instance method)">#<strong>accumulate_outs</strong>(row) &#x21d2; void </a>
258
+
259
+
260
+
261
+ </span>
262
+
263
+
264
+
265
+
266
+
267
+
268
+ <span class="private note title">private</span>
269
+
270
+
271
+ <span class="summary_desc"><div class='inline'>
272
+ <p>Accumulate the outs into arrays of values.</p>
273
+ </div></span>
274
+
275
+ </li>
276
+
277
+
278
+ <li class="public ">
279
+ <span class="summary_signature">
280
+
281
+ <a href="#add_outs-instance_method" title="#add_outs (instance method)">#<strong>add_outs</strong>(row) &#x21d2; void </a>
282
+
283
+
284
+
285
+ </span>
286
+
287
+
288
+
289
+
290
+
291
+
292
+ <span class="private note title">private</span>
293
+
294
+
295
+ <span class="summary_desc"><div class='inline'>
296
+ <p>Common case for building a single row result is just copying output column
297
+ values to the final result hash.</p>
298
+ </div></span>
299
+
300
+ </li>
301
+
302
+
303
+ <li class="public ">
304
+ <span class="summary_signature">
305
+
306
+ <a href="#eval_cell_proc-instance_method" title="#eval_cell_proc (instance method)">#<strong>eval_cell_proc</strong>(proc:, column_name:, index:) &#x21d2; Object </a>
307
+
308
+
309
+
310
+ </span>
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="private note title">private</span>
318
+
319
+
320
+ <span class="summary_desc"><div class='inline'>
321
+ <p>Evaluate the cell proc using the partial result calculated so far.</p>
322
+ </div></span>
323
+
324
+ </li>
325
+
326
+
327
+ <li class="public ">
328
+ <span class="summary_signature">
329
+
330
+ <a href="#eval_outs-instance_method" title="#eval_outs (instance method)">#<strong>eval_outs</strong>(row) &#x21d2; Object </a>
331
+
332
+
333
+
334
+ </span>
335
+
336
+
337
+
338
+
339
+
340
+
341
+ <span class="private note title">private</span>
342
+
343
+
344
+ <span class="summary_desc"><div class='inline'>
345
+ <p>Evaluate the output columns, and use them to start building the final
346
+ result, along with the partial result required to evaluate functions.</p>
347
+ </div></span>
348
+
349
+ </li>
350
+
351
+
352
+ <li class="public ">
353
+ <span class="summary_signature">
354
+
355
+ <a href="#final_result-instance_method" title="#final_result (instance method)">#<strong>final_result</strong> &#x21d2; Hash{Symbol=&gt;Object} </a>
356
+
357
+
358
+
359
+ </span>
360
+
361
+
362
+
363
+
364
+
365
+
366
+ <span class="private note title">private</span>
367
+
368
+
369
+ <span class="summary_desc"><div class='inline'>
370
+ <p>Derive the final result.</p>
371
+ </div></span>
372
+
373
+ </li>
374
+
375
+
376
+ <li class="public ">
377
+ <span class="summary_signature">
378
+
379
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(table:) &#x21d2; Object </a>
380
+
381
+
382
+
383
+ </span>
384
+
385
+
386
+ <span class="note title constructor">constructor</span>
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+ <span class="summary_desc"><div class='inline'></div></span>
396
+
397
+ </li>
398
+
399
+
400
+ <li class="public ">
401
+ <span class="summary_signature">
402
+
403
+ <a href="#input-instance_method" title="#input (instance method)">#<strong>input</strong>(data) &#x21d2; void </a>
404
+
405
+
406
+
407
+ </span>
408
+
409
+
410
+
411
+
412
+
413
+
414
+ <span class="private note title">private</span>
415
+
416
+
417
+ <span class="summary_desc"><div class='inline'>
418
+ <p>Initialize the object for new input data.</p>
419
+ </div></span>
420
+
421
+ </li>
422
+
423
+
424
+ </ul>
425
+
426
+
427
+ <div id="constructor_details" class="method_details_list">
428
+ <h2>Constructor Details</h2>
429
+
430
+ <div class="method_details first">
431
+ <h3 class="signature first" id="initialize-instance_method">
432
+
433
+ #<strong>initialize</strong>(table:) &#x21d2; <tt>Object</tt>
434
+
435
+
436
+
437
+
438
+
439
+ </h3><div class="docstring">
440
+ <div class="discussion">
441
+
442
+
443
+ </div>
444
+ </div>
445
+ <div class="tags">
446
+ <p class="tag_title">Parameters:</p>
447
+ <ul class="param">
448
+
449
+ <li>
450
+
451
+ <span class='name'>table</span>
452
+
453
+
454
+ <span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
455
+
456
+
457
+
458
+ &mdash;
459
+ <div class='inline'>
460
+ <p>Decision table being processed.</p>
461
+ </div>
462
+
463
+ </li>
464
+
465
+ </ul>
466
+
467
+
468
+ </div><table class="source_code">
469
+ <tr>
470
+ <td>
471
+ <pre class="lines">
472
+
473
+
474
+ 25
475
+ 26
476
+ 27
477
+ 28
478
+ 29</pre>
479
+ </td>
480
+ <td>
481
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 25</span>
482
+
483
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>table:</span><span class='rparen'>)</span>
484
+ <span class='ivar'>@outs</span> <span class='op'>=</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_outs'>outs</span>
485
+ <span class='ivar'>@outs_functions</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_outs_functions'>outs_functions</span>
486
+ <span class='ivar'>@table</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span>
487
+ <span class='kw'>end</span></pre>
488
+ </td>
489
+ </tr>
490
+ </table>
491
+ </div>
492
+
493
+ </div>
494
+
495
+ <div id="instance_attr_details" class="attr_details">
496
+ <h2>Instance Attribute Details</h2>
497
+
498
+
499
+ <span id=""></span>
500
+ <div class="method_details first">
501
+ <h3 class="signature first" id="attributes-instance_method">
502
+
503
+ #<strong>attributes</strong> &#x21d2; <tt>Hash{Symbol=&gt;Object}</tt>, <tt>Hash{Integer=&gt;Object}</tt> <span class="extras">(readonly)</span>
504
+
505
+
506
+
507
+
508
+
509
+ </h3><div class="docstring">
510
+ <div class="discussion">
511
+ <p class="note private">
512
+ <strong>This method is part of a private API.</strong>
513
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
514
+ </p>
515
+
516
+ <p>Returns The decision result hash containing both result values and if:
517
+ columns, which eventually get evaluated and removed.</p>
518
+
519
+
520
+ </div>
521
+ </div>
522
+ <div class="tags">
523
+
524
+ <p class="tag_title">Returns:</p>
525
+ <ul class="return">
526
+
527
+ <li>
528
+
529
+
530
+ <span class='type'>(<tt>Hash{Symbol=&gt;Object}</tt>, <tt>Hash{Integer=&gt;Object}</tt>)</span>
531
+
532
+
533
+
534
+ &mdash;
535
+ <div class='inline'>
536
+ <p>The decision result hash containing both result values and if: columns,
537
+ which eventually get evaluated and removed.</p>
538
+ </div>
539
+
540
+ </li>
541
+
542
+ </ul>
543
+
544
+ </div><table class="source_code">
545
+ <tr>
546
+ <td>
547
+ <pre class="lines">
548
+
549
+
550
+ 13
551
+ 14
552
+ 15</pre>
553
+ </td>
554
+ <td>
555
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 13</span>
556
+
557
+ <span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
558
+ <span class='ivar'>@attributes</span>
559
+ <span class='kw'>end</span></pre>
560
+ </td>
561
+ </tr>
562
+ </table>
563
+ </div>
564
+
565
+
566
+ <span id=""></span>
567
+ <div class="method_details ">
568
+ <h3 class="signature " id="multi_result-instance_method">
569
+
570
+ #<strong>multi_result</strong> &#x21d2; <tt>Boolean</tt> <span class="extras">(readonly)</span>
571
+
572
+
573
+
574
+
575
+
576
+ </h3><div class="docstring">
577
+ <div class="discussion">
578
+ <p class="note private">
579
+ <strong>This method is part of a private API.</strong>
580
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
581
+ </p>
582
+
583
+ <p>Returns true if this is a multi-row result</p>
584
+
585
+
586
+ </div>
587
+ </div>
588
+ <div class="tags">
589
+
590
+ <p class="tag_title">Returns:</p>
591
+ <ul class="return">
592
+
593
+ <li>
594
+
595
+
596
+ <span class='type'>(<tt>Boolean</tt>)</span>
597
+
598
+
599
+
600
+ &mdash;
601
+ <div class='inline'>
602
+ <p>Returns true if this is a multi-row result</p>
603
+ </div>
604
+
605
+ </li>
606
+
607
+ </ul>
608
+
609
+ </div><table class="source_code">
610
+ <tr>
611
+ <td>
612
+ <pre class="lines">
613
+
614
+
615
+ 22
616
+ 23
617
+ 24</pre>
618
+ </td>
619
+ <td>
620
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 22</span>
621
+
622
+ <span class='kw'>def</span> <span class='id identifier rubyid_multi_result'>multi_result</span>
623
+ <span class='ivar'>@multi_result</span>
624
+ <span class='kw'>end</span></pre>
625
+ </td>
626
+ </tr>
627
+ </table>
628
+ </div>
629
+
630
+
631
+ <span id=""></span>
632
+ <div class="method_details ">
633
+ <h3 class="signature " id="outs-instance_method">
634
+
635
+ #<strong>outs</strong> &#x21d2; <tt>Hash{<span class='object_link'><a href="Index.html" title="CSVDecision::Index (class)">Index</a></span>=&gt;<span class='object_link'><a href="Dictionary/Entry.html" title="CSVDecision::Dictionary::Entry (class)">Dictionary::Entry</a></span>}</tt> <span class="extras">(readonly)</span>
636
+
637
+
638
+
639
+
640
+
641
+ </h3><div class="docstring">
642
+ <div class="discussion">
643
+ <p class="note private">
644
+ <strong>This method is part of a private API.</strong>
645
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
646
+ </p>
647
+
648
+ <p>Returns Output columns.</p>
649
+
650
+
651
+ </div>
652
+ </div>
653
+ <div class="tags">
654
+
655
+ <p class="tag_title">Returns:</p>
656
+ <ul class="return">
657
+
658
+ <li>
659
+
660
+
661
+ <span class='type'>(<tt>Hash{<span class='object_link'><a href="Index.html" title="CSVDecision::Index (class)">Index</a></span>=&gt;<span class='object_link'><a href="Dictionary/Entry.html" title="CSVDecision::Dictionary::Entry (class)">Dictionary::Entry</a></span>}</tt>)</span>
662
+
663
+
664
+
665
+ &mdash;
666
+ <div class='inline'>
667
+ <p>Output columns.</p>
668
+ </div>
669
+
670
+ </li>
671
+
672
+ </ul>
673
+
674
+ </div><table class="source_code">
675
+ <tr>
676
+ <td>
677
+ <pre class="lines">
678
+
679
+
680
+ 16
681
+ 17
682
+ 18</pre>
683
+ </td>
684
+ <td>
685
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 16</span>
686
+
687
+ <span class='kw'>def</span> <span class='id identifier rubyid_outs'>outs</span>
688
+ <span class='ivar'>@outs</span>
689
+ <span class='kw'>end</span></pre>
690
+ </td>
691
+ </tr>
692
+ </table>
693
+ </div>
694
+
695
+
696
+ <span id=""></span>
697
+ <div class="method_details ">
698
+ <h3 class="signature " id="outs_functions-instance_method">
699
+
700
+ #<strong>outs_functions</strong> &#x21d2; <tt>nil</tt>, <tt>true</tt> <span class="extras">(readonly)</span>
701
+
702
+
703
+
704
+
705
+
706
+ </h3><div class="docstring">
707
+ <div class="discussion">
708
+ <p class="note private">
709
+ <strong>This method is part of a private API.</strong>
710
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
711
+ </p>
712
+
713
+ <p>Returns Set to true if the table has output functions.</p>
714
+
715
+
716
+ </div>
717
+ </div>
718
+ <div class="tags">
719
+
720
+ <p class="tag_title">Returns:</p>
721
+ <ul class="return">
722
+
723
+ <li>
724
+
725
+
726
+ <span class='type'>(<tt>nil</tt>, <tt>true</tt>)</span>
727
+
728
+
729
+
730
+ &mdash;
731
+ <div class='inline'>
732
+ <p>Set to true if the table has output functions.</p>
733
+ </div>
734
+
735
+ </li>
736
+
737
+ </ul>
738
+
739
+ </div><table class="source_code">
740
+ <tr>
741
+ <td>
742
+ <pre class="lines">
743
+
744
+
745
+ 19
746
+ 20
747
+ 21</pre>
748
+ </td>
749
+ <td>
750
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 19</span>
751
+
752
+ <span class='kw'>def</span> <span class='id identifier rubyid_outs_functions'>outs_functions</span>
753
+ <span class='ivar'>@outs_functions</span>
754
+ <span class='kw'>end</span></pre>
755
+ </td>
756
+ </tr>
757
+ </table>
758
+ </div>
759
+
760
+ </div>
761
+
762
+
763
+ <div id="instance_method_details" class="method_details_list">
764
+ <h2>Instance Method Details</h2>
765
+
766
+
767
+ <div class="method_details first">
768
+ <h3 class="signature first" id="accumulate_outs-instance_method">
769
+
770
+ #<strong>accumulate_outs</strong>(row) &#x21d2; <tt>void</tt>
771
+
772
+
773
+
774
+
775
+
776
+ </h3><div class="docstring">
777
+ <div class="discussion">
778
+ <p class="note private">
779
+ <strong>This method is part of a private API.</strong>
780
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
781
+ </p>
782
+ <p class="note returns_void">This method returns an undefined value.</p>
783
+ <p>Accumulate the outs into arrays of values.</p>
784
+
785
+
786
+ </div>
787
+ </div>
788
+ <div class="tags">
789
+ <p class="tag_title">Parameters:</p>
790
+ <ul class="param">
791
+
792
+ <li>
793
+
794
+ <span class='name'>row</span>
795
+
796
+
797
+ <span class='type'>(<tt>Array</tt>)</span>
798
+
799
+
800
+
801
+ </li>
802
+
803
+ </ul>
804
+
805
+
806
+ </div><table class="source_code">
807
+ <tr>
808
+ <td>
809
+ <pre class="lines">
810
+
811
+
812
+ 58
813
+ 59
814
+ 60</pre>
815
+ </td>
816
+ <td>
817
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 58</span>
818
+
819
+ <span class='kw'>def</span> <span class='id identifier rubyid_accumulate_outs'>accumulate_outs</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
820
+ <span class='ivar'>@outs</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='lbrace'>{</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> <span class='id identifier rubyid_add_cell'>add_cell</span><span class='lparen'>(</span><span class='label'>column_name:</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>cell:</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='rbrace'>}</span>
821
+ <span class='kw'>end</span></pre>
822
+ </td>
823
+ </tr>
824
+ </table>
825
+ </div>
826
+
827
+ <div class="method_details ">
828
+ <h3 class="signature " id="add_outs-instance_method">
829
+
830
+ #<strong>add_outs</strong>(row) &#x21d2; <tt>void</tt>
831
+
832
+
833
+
834
+
835
+
836
+ </h3><div class="docstring">
837
+ <div class="discussion">
838
+ <p class="note private">
839
+ <strong>This method is part of a private API.</strong>
840
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
841
+ </p>
842
+ <p class="note returns_void">This method returns an undefined value.</p>
843
+ <p>Common case for building a single row result is just copying output column
844
+ values to the final result hash.</p>
845
+
846
+
847
+ </div>
848
+ </div>
849
+ <div class="tags">
850
+ <p class="tag_title">Parameters:</p>
851
+ <ul class="param">
852
+
853
+ <li>
854
+
855
+ <span class='name'>row</span>
856
+
857
+
858
+ <span class='type'>(<tt>Array</tt>)</span>
859
+
860
+
861
+
862
+ </li>
863
+
864
+ </ul>
865
+
866
+
867
+ </div><table class="source_code">
868
+ <tr>
869
+ <td>
870
+ <pre class="lines">
871
+
872
+
873
+ 51
874
+ 52
875
+ 53</pre>
876
+ </td>
877
+ <td>
878
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 51</span>
879
+
880
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_outs'>add_outs</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
881
+ <span class='ivar'>@outs</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='lbrace'>{</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> <span class='ivar'>@attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</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='rbrace'>}</span>
882
+ <span class='kw'>end</span></pre>
883
+ </td>
884
+ </tr>
885
+ </table>
886
+ </div>
887
+
888
+ <div class="method_details ">
889
+ <h3 class="signature " id="eval_cell_proc-instance_method">
890
+
891
+ #<strong>eval_cell_proc</strong>(proc:, column_name:, index:) &#x21d2; <tt>Object</tt>
892
+
893
+
894
+
895
+
896
+
897
+ </h3><div class="docstring">
898
+ <div class="discussion">
899
+ <p class="note private">
900
+ <strong>This method is part of a private API.</strong>
901
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
902
+ </p>
903
+
904
+ <p>Evaluate the cell proc using the partial result calculated so far.</p>
905
+
906
+
907
+ </div>
908
+ </div>
909
+ <div class="tags">
910
+ <p class="tag_title">Parameters:</p>
911
+ <ul class="param">
912
+
913
+ <li>
914
+
915
+ <span class='name'>proc</span>
916
+
917
+
918
+ <span class='type'>(<tt>Matchers::Pro</tt>)</span>
919
+
920
+
921
+
922
+ </li>
923
+
924
+ <li>
925
+
926
+ <span class='name'>column_name</span>
927
+
928
+
929
+ <span class='type'>(<tt>Symbol</tt>, <tt>Integer</tt>)</span>
930
+
931
+
932
+
933
+ </li>
934
+
935
+ <li>
936
+
937
+ <span class='name'>index</span>
938
+
939
+
940
+ <span class='type'>(<tt>Integer</tt>)</span>
941
+
942
+
943
+
944
+ </li>
945
+
946
+ </ul>
947
+
948
+
949
+ </div><table class="source_code">
950
+ <tr>
951
+ <td>
952
+ <pre class="lines">
953
+
954
+
955
+ 91
956
+ 92
957
+ 93</pre>
958
+ </td>
959
+ <td>
960
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 91</span>
961
+
962
+ <span class='kw'>def</span> <span class='id identifier rubyid_eval_cell_proc'>eval_cell_proc</span><span class='lparen'>(</span><span class='label'>proc:</span><span class='comma'>,</span> <span class='label'>column_name:</span><span class='comma'>,</span> <span class='label'>index:</span><span class='rparen'>)</span>
963
+ <span class='ivar'>@attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_column_name'>column_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_proc'>proc</span><span class='period'>.</span><span class='id identifier rubyid_function'>function</span><span class='lbracket'>[</span><span class='id identifier rubyid_partial_result'>partial_result</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span><span class='rbracket'>]</span>
964
+ <span class='kw'>end</span></pre>
965
+ </td>
966
+ </tr>
967
+ </table>
968
+ </div>
969
+
970
+ <div class="method_details ">
971
+ <h3 class="signature " id="eval_outs-instance_method">
972
+
973
+ #<strong>eval_outs</strong>(row) &#x21d2; <tt>Object</tt>
974
+
975
+
976
+
977
+
978
+
979
+ </h3><div class="docstring">
980
+ <div class="discussion">
981
+ <p class="note private">
982
+ <strong>This method is part of a private API.</strong>
983
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
984
+ </p>
985
+
986
+ <p>Evaluate the output columns, and use them to start building the final
987
+ result, along with the partial result required to evaluate functions.</p>
988
+
989
+
990
+ </div>
991
+ </div>
992
+ <div class="tags">
993
+ <p class="tag_title">Parameters:</p>
994
+ <ul class="param">
995
+
996
+ <li>
997
+
998
+ <span class='name'>row</span>
999
+
1000
+
1001
+ <span class='type'>(<tt>Array</tt>)</span>
1002
+
1003
+
1004
+
1005
+ </li>
1006
+
1007
+ </ul>
1008
+
1009
+
1010
+ </div><table class="source_code">
1011
+ <tr>
1012
+ <td>
1013
+ <pre class="lines">
1014
+
1015
+
1016
+ 76
1017
+ 77
1018
+ 78
1019
+ 79
1020
+ 80
1021
+ 81
1022
+ 82
1023
+ 83
1024
+ 84</pre>
1025
+ </td>
1026
+ <td>
1027
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 76</span>
1028
+
1029
+ <span class='kw'>def</span> <span class='id identifier rubyid_eval_outs'>eval_outs</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1030
+ <span class='comment'># Set the constants first, in case the functions refer to them
1031
+ </span> <span class='id identifier rubyid_eval_outs_constants'>eval_outs_constants</span><span class='lparen'>(</span><span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1032
+
1033
+ <span class='comment'># Then evaluate the procs, left to right
1034
+ </span> <span class='id identifier rubyid_eval_outs_procs'>eval_outs_procs</span><span class='lparen'>(</span><span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1035
+
1036
+ <span class='id identifier rubyid_final_result'>final_result</span>
1037
+ <span class='kw'>end</span></pre>
1038
+ </td>
1039
+ </tr>
1040
+ </table>
1041
+ </div>
1042
+
1043
+ <div class="method_details ">
1044
+ <h3 class="signature " id="final_result-instance_method">
1045
+
1046
+ #<strong>final_result</strong> &#x21d2; <tt>Hash{Symbol=&gt;Object}</tt>
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+ </h3><div class="docstring">
1053
+ <div class="discussion">
1054
+ <p class="note private">
1055
+ <strong>This method is part of a private API.</strong>
1056
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1057
+ </p>
1058
+
1059
+ <p>Derive the final result.</p>
1060
+
1061
+
1062
+ </div>
1063
+ </div>
1064
+ <div class="tags">
1065
+
1066
+ <p class="tag_title">Returns:</p>
1067
+ <ul class="return">
1068
+
1069
+ <li>
1070
+
1071
+
1072
+ <span class='type'>(<tt>Hash{Symbol=&gt;Object}</tt>)</span>
1073
+
1074
+
1075
+
1076
+ </li>
1077
+
1078
+ </ul>
1079
+
1080
+ </div><table class="source_code">
1081
+ <tr>
1082
+ <td>
1083
+ <pre class="lines">
1084
+
1085
+
1086
+ 64
1087
+ 65
1088
+ 66
1089
+ 67
1090
+ 68
1091
+ 69</pre>
1092
+ </td>
1093
+ <td>
1094
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 64</span>
1095
+
1096
+ <span class='kw'>def</span> <span class='id identifier rubyid_final_result'>final_result</span>
1097
+ <span class='comment'># If there are no if: columns, then nothing needs to be filtered out of this result hash.
1098
+ </span> <span class='kw'>return</span> <span class='ivar'>@attributes</span> <span class='kw'>if</span> <span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_ifs'>ifs</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1099
+
1100
+ <span class='ivar'>@multi_result</span> <span class='op'>?</span> <span class='id identifier rubyid_multi_row_result'>multi_row_result</span> <span class='op'>:</span> <span class='id identifier rubyid_single_row_result'>single_row_result</span>
1101
+ <span class='kw'>end</span></pre>
1102
+ </td>
1103
+ </tr>
1104
+ </table>
1105
+ </div>
1106
+
1107
+ <div class="method_details ">
1108
+ <h3 class="signature " id="input-instance_method">
1109
+
1110
+ #<strong>input</strong>(data) &#x21d2; <tt>void</tt>
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+ </h3><div class="docstring">
1117
+ <div class="discussion">
1118
+ <p class="note private">
1119
+ <strong>This method is part of a private API.</strong>
1120
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1121
+ </p>
1122
+ <p class="note returns_void">This method returns an undefined value.</p>
1123
+ <p>Initialize the object for new input data.</p>
1124
+
1125
+
1126
+ </div>
1127
+ </div>
1128
+ <div class="tags">
1129
+ <p class="tag_title">Parameters:</p>
1130
+ <ul class="param">
1131
+
1132
+ <li>
1133
+
1134
+ <span class='name'>data</span>
1135
+
1136
+
1137
+ <span class='type'>(<tt>Hash{Symbol=&gt;Object}</tt>)</span>
1138
+
1139
+
1140
+
1141
+ &mdash;
1142
+ <div class='inline'>
1143
+ <p>Input data hash.</p>
1144
+ </div>
1145
+
1146
+ </li>
1147
+
1148
+ </ul>
1149
+
1150
+
1151
+ </div><table class="source_code">
1152
+ <tr>
1153
+ <td>
1154
+ <pre class="lines">
1155
+
1156
+
1157
+ 35
1158
+ 36
1159
+ 37
1160
+ 38
1161
+ 39
1162
+ 40
1163
+ 41
1164
+ 42
1165
+ 43
1166
+ 44
1167
+ 45</pre>
1168
+ </td>
1169
+ <td>
1170
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/result.rb', line 35</span>
1171
+
1172
+ <span class='kw'>def</span> <span class='id identifier rubyid_input'>input</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
1173
+ <span class='comment'># Attributes hash contains the output decision key value pairs
1174
+ </span> <span class='ivar'>@attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1175
+ <span class='ivar'>@multi_result</span> <span class='op'>=</span> <span class='kw'>false</span>
1176
+ <span class='comment'># Partial result always copies in the input hash for calculating output functions.
1177
+ </span> <span class='comment'># Note that these input key values will not be mutated, as output columns can never
1178
+ </span> <span class='comment'># have the same symbol as an input hash key.
1179
+ </span> <span class='comment'># However, the rest of this hash is mutated as output column evaluation results
1180
+ </span> <span class='comment'># are accumulated.
1181
+ </span> <span class='ivar'>@partial_result</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='op'>*</span><span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_input_keys'>input_keys</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@outs_functions</span>
1182
+ <span class='kw'>end</span></pre>
1183
+ </td>
1184
+ </tr>
1185
+ </table>
1186
+ </div>
1187
+
1188
+ </div>
1189
+
1190
+ </div>
1191
+
1192
+ <div id="footer">
1193
+ Generated on Sun Feb 11 10:26:08 2018 by
1194
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1195
+ 0.9.12 (ruby-2.4.0).
1196
+ </div>
1197
+
1198
+ </div>
1199
+ </body>
1200
+ </html>