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,484 @@
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::Matchers::Constant
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::Matchers::Constant";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span>
41
+ &raquo;
42
+ <span class="title">Constant</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::Matchers::Constant
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"><span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></li>
78
+
79
+ <li class="next">CSVDecision::Matchers::Constant</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/csv_decision/matchers/constant.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p class="note private">
107
+ <strong>This class is part of a private API.</strong>
108
+ You should avoid using this class if possible, as it may be removed or be changed in the future.
109
+ </p>
110
+
111
+ <p>Cell constant matcher - e.g., := true, = nil.</p>
112
+
113
+
114
+ </div>
115
+ </div>
116
+ <div class="tags">
117
+
118
+
119
+ </div>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+ <h2>
128
+ Class Method Summary
129
+ <small><a href="#" class="summary_toggle">collapse</a></small>
130
+ </h2>
131
+
132
+ <ul class="summary">
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#matches%3F-class_method" title="matches? (class method)">.<strong>matches?</strong>(cell) &#x21d2; false, CSVDecision::Proc </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="private note title">private</span>
149
+
150
+
151
+ <span class="summary_desc"><div class='inline'>
152
+ <p>Returns false if this cell is not a match; otherwise returns the
153
+ <code>CSVDecision::Proc</code> object indicating if this is a constant or
154
+ some type of function.</p>
155
+ </div></span>
156
+
157
+ </li>
158
+
159
+
160
+ </ul>
161
+
162
+ <h2>
163
+ Instance Method Summary
164
+ <small><a href="#" class="summary_toggle">collapse</a></small>
165
+ </h2>
166
+
167
+ <ul class="summary">
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#matches%3F-instance_method" title="#matches? (instance method)">#<strong>matches?</strong>(cell) &#x21d2; Boolean </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="private note title">private</span>
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>If a constant expression returns a Proc of type :constant, otherwise
188
+ return false.</p>
189
+ </div></span>
190
+
191
+ </li>
192
+
193
+
194
+ <li class="public ">
195
+ <span class="summary_signature">
196
+
197
+ <a href="#outs%3F-instance_method" title="#outs? (instance method)">#<strong>outs?</strong> &#x21d2; Boolean </a>
198
+
199
+
200
+
201
+ </span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+ <span class="private note title">private</span>
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'>
212
+ <p>Does this matcher apply to output cells?.</p>
213
+ </div></span>
214
+
215
+ </li>
216
+
217
+
218
+ </ul>
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></h3>
231
+ <p class="inherited"><span class='object_link'><a href="Matcher.html#initialize-instance_method" title="CSVDecision::Matchers::Matcher#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Matcher.html#ins%3F-instance_method" title="CSVDecision::Matchers::Matcher#ins? (method)">#ins?</a></span></p>
232
+ <div id="constructor_details" class="method_details_list">
233
+ <h2>Constructor Details</h2>
234
+
235
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="Matcher.html#initialize-instance_method" title="CSVDecision::Matchers::Matcher#initialize (method)">CSVDecision::Matchers::Matcher</a></span></p>
236
+
237
+ </div>
238
+
239
+
240
+ <div id="class_method_details" class="method_details_list">
241
+ <h2>Class Method Details</h2>
242
+
243
+
244
+ <div class="method_details first">
245
+ <h3 class="signature first" id="matches?-class_method">
246
+
247
+ .<strong>matches?</strong>(cell) &#x21d2; <tt>false</tt>, <tt>CSVDecision::Proc</tt>
248
+
249
+
250
+
251
+
252
+
253
+ </h3><div class="docstring">
254
+ <div class="discussion">
255
+ <p class="note private">
256
+ <strong>This method is part of a private API.</strong>
257
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
258
+ </p>
259
+
260
+ <p>Returns false if this cell is not a match; otherwise returns the
261
+ <code>CSVDecision::Proc</code> object indicating if this is a constant or
262
+ some type of function.</p>
263
+
264
+
265
+ </div>
266
+ </div>
267
+ <div class="tags">
268
+ <p class="tag_title">Parameters:</p>
269
+ <ul class="param">
270
+
271
+ <li>
272
+
273
+ <span class='name'>cell</span>
274
+
275
+
276
+ <span class='type'>(<tt>String</tt>)</span>
277
+
278
+
279
+
280
+ &mdash;
281
+ <div class='inline'>
282
+ <p>Data row cell.</p>
283
+ </div>
284
+
285
+ </li>
286
+
287
+ </ul>
288
+
289
+ <p class="tag_title">Returns:</p>
290
+ <ul class="return">
291
+
292
+ <li>
293
+
294
+
295
+ <span class='type'>(<tt>false</tt>, <tt>CSVDecision::Proc</tt>)</span>
296
+
297
+
298
+
299
+ &mdash;
300
+ <div class='inline'>
301
+ <p>Returns false if this cell is not a match; otherwise returns the
302
+ <code>CSVDecision::Proc</code> object indicating if this is a constant or
303
+ some type of function.</p>
304
+ </div>
305
+
306
+ </li>
307
+
308
+ </ul>
309
+
310
+ </div><table class="source_code">
311
+ <tr>
312
+ <td>
313
+ <pre class="lines">
314
+
315
+
316
+ 31
317
+ 32
318
+ 33
319
+ 34
320
+ 35
321
+ 36
322
+ 37
323
+ 38</pre>
324
+ </td>
325
+ <td>
326
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/constant.rb', line 31</span>
327
+
328
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
329
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='const'>EXPRESSION</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span><span class='rparen'>)</span>
330
+
331
+ <span class='id identifier rubyid_proc'>proc</span> <span class='op'>=</span> <span class='id identifier rubyid_non_numeric?'>non_numeric?</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
332
+ <span class='kw'>return</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>if</span> <span class='id identifier rubyid_proc'>proc</span>
333
+
334
+ <span class='id identifier rubyid_numeric?'>numeric?</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
335
+ <span class='kw'>end</span></pre>
336
+ </td>
337
+ </tr>
338
+ </table>
339
+ </div>
340
+
341
+ </div>
342
+
343
+ <div id="instance_method_details" class="method_details_list">
344
+ <h2>Instance Method Details</h2>
345
+
346
+
347
+ <div class="method_details first">
348
+ <h3 class="signature first" id="matches?-instance_method">
349
+
350
+ #<strong>matches?</strong>(cell) &#x21d2; <tt>Boolean</tt>
351
+
352
+
353
+
354
+
355
+
356
+ </h3><div class="docstring">
357
+ <div class="discussion">
358
+ <p class="note private">
359
+ <strong>This method is part of a private API.</strong>
360
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
361
+ </p>
362
+
363
+ <p>If a constant expression returns a Proc of type :constant,</p>
364
+
365
+ <pre class="code ruby"><code class="ruby">otherwise return false.</code></pre>
366
+
367
+ <p>(see Matcher#matches?)</p>
368
+
369
+
370
+ </div>
371
+ </div>
372
+ <div class="tags">
373
+
374
+ <p class="tag_title">Returns:</p>
375
+ <ul class="return">
376
+
377
+ <li>
378
+
379
+
380
+ <span class='type'>(<tt>Boolean</tt>)</span>
381
+
382
+
383
+
384
+ </li>
385
+
386
+ </ul>
387
+
388
+ </div><table class="source_code">
389
+ <tr>
390
+ <td>
391
+ <pre class="lines">
392
+
393
+
394
+ 64
395
+ 65
396
+ 66</pre>
397
+ </td>
398
+ <td>
399
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/constant.rb', line 64</span>
400
+
401
+ <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
402
+ <span class='const'><span class='object_link'><a href="../Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="CSVDecision::Matchers::Constant (class)">Constant</a></span></span><span class='period'>.</span><span class='id identifier rubyid_matches?'><span class='object_link'><a href="#matches%3F-class_method" title="CSVDecision::Matchers::Constant.matches? (method)">matches?</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
403
+ <span class='kw'>end</span></pre>
404
+ </td>
405
+ </tr>
406
+ </table>
407
+ </div>
408
+
409
+ <div class="method_details ">
410
+ <h3 class="signature " id="outs?-instance_method">
411
+
412
+ #<strong>outs?</strong> &#x21d2; <tt>Boolean</tt>
413
+
414
+
415
+
416
+
417
+
418
+ </h3><div class="docstring">
419
+ <div class="discussion">
420
+ <p class="note private">
421
+ <strong>This method is part of a private API.</strong>
422
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
423
+ </p>
424
+
425
+ <p>Does this matcher apply to output cells?</p>
426
+
427
+
428
+ </div>
429
+ </div>
430
+ <div class="tags">
431
+
432
+ <p class="tag_title">Returns:</p>
433
+ <ul class="return">
434
+
435
+ <li>
436
+
437
+
438
+ <span class='type'>(<tt>Boolean</tt>)</span>
439
+
440
+
441
+
442
+ &mdash;
443
+ <div class='inline'>
444
+ <p>Return true if this matcher applies to output cells, false otherwise.</p>
445
+ </div>
446
+
447
+ </li>
448
+
449
+ </ul>
450
+
451
+ </div><table class="source_code">
452
+ <tr>
453
+ <td>
454
+ <pre class="lines">
455
+
456
+
457
+ 69
458
+ 70
459
+ 71</pre>
460
+ </td>
461
+ <td>
462
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/constant.rb', line 69</span>
463
+
464
+ <span class='kw'>def</span> <span class='id identifier rubyid_outs?'>outs?</span>
465
+ <span class='kw'>true</span>
466
+ <span class='kw'>end</span></pre>
467
+ </td>
468
+ </tr>
469
+ </table>
470
+ </div>
471
+
472
+ </div>
473
+
474
+ </div>
475
+
476
+ <div id="footer">
477
+ Generated on Sun Feb 11 10:26:09 2018 by
478
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
479
+ 0.9.12 (ruby-2.4.0).
480
+ </div>
481
+
482
+ </div>
483
+ </body>
484
+ </html>