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,1567 @@
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
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";
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 (M)</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">Matchers</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
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::Matchers</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.rb<span class="defines">,<br />
98
+ lib/csv_decision/matchers.rb,<br /> lib/csv_decision/matchers/guard.rb,<br /> lib/csv_decision/matchers/range.rb,<br /> lib/csv_decision/matchers/symbol.rb,<br /> lib/csv_decision/matchers/numeric.rb,<br /> lib/csv_decision/matchers/pattern.rb,<br /> lib/csv_decision/matchers/constant.rb,<br /> lib/csv_decision/matchers/function.rb</span>
99
+ </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>Methods to assign a matcher to data cells</p>
112
+
113
+
114
+ </div>
115
+ </div>
116
+ <div class="tags">
117
+
118
+
119
+ </div><h2>Defined Under Namespace</h2>
120
+ <p class="children">
121
+
122
+
123
+
124
+
125
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Matchers/Constant.html" title="CSVDecision::Matchers::Constant (class)">Constant</a></span>, <span class='object_link'><a href="Matchers/Function.html" title="CSVDecision::Matchers::Function (class)">Function</a></span>, <span class='object_link'><a href="Matchers/Guard.html" title="CSVDecision::Matchers::Guard (class)">Guard</a></span>, <span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span>, <span class='object_link'><a href="Matchers/Numeric.html" title="CSVDecision::Matchers::Numeric (class)">Numeric</a></span>, <span class='object_link'><a href="Matchers/Pattern.html" title="CSVDecision::Matchers::Pattern (class)">Pattern</a></span>, <span class='object_link'><a href="Matchers/Proc.html" title="CSVDecision::Matchers::Proc (class)">Proc</a></span>, <span class='object_link'><a href="Matchers/Range.html" title="CSVDecision::Matchers::Range (class)">Range</a></span>, <span class='object_link'><a href="Matchers/Symbol.html" title="CSVDecision::Matchers::Symbol (class)">Symbol</a></span>
126
+
127
+
128
+ </p>
129
+
130
+ <h2>Constant Summary</h2>
131
+ <dl class="constants">
132
+
133
+ <dt id="NEGATE-constant" class="">NEGATE =
134
+ <div class="docstring">
135
+ <div class="discussion">
136
+ <p class="note private">
137
+ <strong>This constant is part of a private API.</strong>
138
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
139
+ </p>
140
+
141
+ <p>Negation sign prefixed to ranges and functions.</p>
142
+
143
+
144
+ </div>
145
+ </div>
146
+ <div class="tags">
147
+
148
+
149
+ </div>
150
+ </dt>
151
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>!</span><span class='tstring_end'>&#39;</span></span></pre></dd>
152
+
153
+ <dt id="INEQUALITY-constant" class="">INEQUALITY =
154
+ <div class="docstring">
155
+ <div class="discussion">
156
+ <p class="note private">
157
+ <strong>This constant is part of a private API.</strong>
158
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
159
+ </p>
160
+
161
+ <p>Symbols used for inequality</p>
162
+
163
+
164
+ </div>
165
+ </div>
166
+ <div class="tags">
167
+
168
+
169
+ </div>
170
+ </dt>
171
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>!=|!</span><span class='tstring_end'>&#39;</span></span></pre></dd>
172
+
173
+ <dt id="INEQUALITY_RE-constant" class="">INEQUALITY_RE =
174
+ <div class="docstring">
175
+ <div class="discussion">
176
+ <p class="note private">
177
+ <strong>This constant is part of a private API.</strong>
178
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
179
+ </p>
180
+
181
+ <p>Match Regexp for inequality</p>
182
+
183
+
184
+ </div>
185
+ </div>
186
+ <div class="tags">
187
+
188
+
189
+ </div>
190
+ </dt>
191
+ <dd><pre class="code"><span class='id identifier rubyid_regexp'>regexp</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#INEQUALITY-constant" title="CSVDecision::Matchers::INEQUALITY (constant)">INEQUALITY</a></span></span><span class='rparen'>)</span></pre></dd>
192
+
193
+ <dt id="EQUALS-constant" class="">EQUALS =
194
+ <div class="docstring">
195
+ <div class="discussion">
196
+ <p class="note private">
197
+ <strong>This constant is part of a private API.</strong>
198
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
199
+ </p>
200
+
201
+ <p>Equality, cell constants and functions specified by prefixing the value
202
+ with one of these 3 symbols.</p>
203
+
204
+
205
+ </div>
206
+ </div>
207
+ <div class="tags">
208
+
209
+
210
+ </div>
211
+ </dt>
212
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>==|:=|=</span><span class='tstring_end'>&#39;</span></span></pre></dd>
213
+
214
+ <dt id="EQUALS_RE-constant" class="">EQUALS_RE =
215
+ <div class="docstring">
216
+ <div class="discussion">
217
+ <p class="note private">
218
+ <strong>This constant is part of a private API.</strong>
219
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
220
+ </p>
221
+
222
+ <p>Match Regexp for equality</p>
223
+
224
+
225
+ </div>
226
+ </div>
227
+ <div class="tags">
228
+
229
+
230
+ </div>
231
+ </dt>
232
+ <dd><pre class="code"><span class='id identifier rubyid_regexp'>regexp</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#EQUALS-constant" title="CSVDecision::Matchers::EQUALS (constant)">EQUALS</a></span></span><span class='rparen'>)</span></pre></dd>
233
+
234
+ <dt id="METHOD_NAME_RE-constant" class="">METHOD_NAME_RE =
235
+ <div class="docstring">
236
+ <div class="discussion">
237
+ <p class="note private">
238
+ <strong>This constant is part of a private API.</strong>
239
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
240
+ </p>
241
+
242
+ <p>Method names are stricter than CSV column names.</p>
243
+
244
+
245
+ </div>
246
+ </div>
247
+ <div class="tags">
248
+
249
+
250
+ </div>
251
+ </dt>
252
+ <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[_a-z][_a-z0-9]*[?!=]?\z</span><span class='regexp_end'>/</span></span></pre></dd>
253
+
254
+ <dt id="NUMERIC-constant" class="">NUMERIC =
255
+ <div class="docstring">
256
+ <div class="discussion">
257
+ <p class="note private">
258
+ <strong>This constant is part of a private API.</strong>
259
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
260
+ </p>
261
+
262
+ <p>Regular expression used to recognise a numeric string with or without a
263
+ decimal point.</p>
264
+
265
+
266
+ </div>
267
+ </div>
268
+ <div class="tags">
269
+
270
+
271
+ </div>
272
+ </dt>
273
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[-+]?\d*(?&lt;decimal&gt;\.?)\d*</span><span class='tstring_end'>&#39;</span></span></pre></dd>
274
+
275
+ </dl>
276
+
277
+
278
+
279
+
280
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
281
+ <ul class="summary">
282
+
283
+ <li class="public ">
284
+ <span class="summary_signature">
285
+
286
+ <a href="#ins-instance_method" title="#ins (instance method)">#<strong>ins</strong> &#x21d2; Array&lt;Matchers::Matcher&gt; </a>
287
+
288
+
289
+
290
+ </span>
291
+
292
+
293
+
294
+
295
+ <span class="note title readonly">readonly</span>
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="private note title">private</span>
303
+
304
+
305
+ <span class="summary_desc"><div class='inline'>
306
+ <p>Matchers for the input columns.</p>
307
+ </div></span>
308
+
309
+ </li>
310
+
311
+
312
+ <li class="public ">
313
+ <span class="summary_signature">
314
+
315
+ <a href="#outs-instance_method" title="#outs (instance method)">#<strong>outs</strong> &#x21d2; Array&lt;Matchers::Matcher&gt; </a>
316
+
317
+
318
+
319
+ </span>
320
+
321
+
322
+
323
+
324
+ <span class="note title readonly">readonly</span>
325
+
326
+
327
+
328
+
329
+
330
+
331
+ <span class="private note title">private</span>
332
+
333
+
334
+ <span class="summary_desc"><div class='inline'>
335
+ <p>Matchers for the output columns.</p>
336
+ </div></span>
337
+
338
+ </li>
339
+
340
+
341
+ </ul>
342
+
343
+
344
+
345
+
346
+
347
+ <h2>
348
+ Class Method Summary
349
+ <small><a href="#" class="summary_toggle">collapse</a></small>
350
+ </h2>
351
+
352
+ <ul class="summary">
353
+
354
+ <li class="public ">
355
+ <span class="summary_signature">
356
+
357
+ <a href="#compare%3F-class_method" title="compare? (class method)">.<strong>compare?</strong>(lhs:, compare:, rhs:) &#x21d2; nil, Boolean </a>
358
+
359
+
360
+
361
+ </span>
362
+
363
+
364
+
365
+
366
+
367
+
368
+ <span class="private note title">private</span>
369
+
370
+
371
+ <span class="summary_desc"><div class='inline'>
372
+ <p>Compare one object with another if they both respond to the compare method.</p>
373
+ </div></span>
374
+
375
+ </li>
376
+
377
+
378
+ <li class="public ">
379
+ <span class="summary_signature">
380
+
381
+ <a href="#normalize_operator-class_method" title="normalize_operator (class method)">.<strong>normalize_operator</strong>(operator) &#x21d2; String </a>
382
+
383
+
384
+
385
+ </span>
386
+
387
+
388
+
389
+
390
+
391
+
392
+ <span class="private note title">private</span>
393
+
394
+
395
+ <span class="summary_desc"><div class='inline'>
396
+ <p>Normalize the operators which are a variation on equals/assignment.</p>
397
+ </div></span>
398
+
399
+ </li>
400
+
401
+
402
+ <li class="public ">
403
+ <span class="summary_signature">
404
+
405
+ <a href="#numeric-class_method" title="numeric (class method)">.<strong>numeric</strong>(value) &#x21d2; nil, ... </a>
406
+
407
+
408
+
409
+ </span>
410
+
411
+
412
+
413
+
414
+
415
+
416
+ <span class="private note title">private</span>
417
+
418
+
419
+ <span class="summary_desc"><div class='inline'>
420
+ <p>Validate a numeric value and convert it to an Integer or BigDecimal if a
421
+ valid numeric string.</p>
422
+ </div></span>
423
+
424
+ </li>
425
+
426
+
427
+ <li class="public ">
428
+ <span class="summary_signature">
429
+
430
+ <a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(columns:, matchers:, row:) &#x21d2; Array&lt;(Array, ScanRow)&gt; </a>
431
+
432
+
433
+
434
+ </span>
435
+
436
+
437
+
438
+
439
+
440
+
441
+ <span class="private note title">private</span>
442
+
443
+
444
+ <span class="summary_desc"><div class='inline'>
445
+ <p>Parse the supplied input columns for the row supplied using an array of
446
+ matchers.</p>
447
+ </div></span>
448
+
449
+ </li>
450
+
451
+
452
+ <li class="public ">
453
+ <span class="summary_signature">
454
+
455
+ <a href="#regexp-class_method" title="regexp (class method)">.<strong>regexp</strong>(value) &#x21d2; Regexp </a>
456
+
457
+
458
+
459
+ </span>
460
+
461
+
462
+
463
+
464
+
465
+
466
+ <span class="private note title">private</span>
467
+
468
+
469
+ <span class="summary_desc"><div class='inline'>
470
+ <p>All regular expressions used for matching are anchored inside their own
471
+ non-capturing group.</p>
472
+ </div></span>
473
+
474
+ </li>
475
+
476
+
477
+ <li class="public ">
478
+ <span class="summary_signature">
479
+
480
+ <a href="#to_numeric-class_method" title="to_numeric (class method)">.<strong>to_numeric</strong>(value) &#x21d2; nil, ... </a>
481
+
482
+
483
+
484
+ </span>
485
+
486
+
487
+
488
+
489
+
490
+
491
+ <span class="private note title">private</span>
492
+
493
+
494
+ <span class="summary_desc"><div class='inline'>
495
+ <p>Convert a numeric string into an Integer or BigDecimal, otherwise return
496
+ nil.</p>
497
+ </div></span>
498
+
499
+ </li>
500
+
501
+
502
+ </ul>
503
+
504
+ <h2>
505
+ Instance Method Summary
506
+ <small><a href="#" class="summary_toggle">collapse</a></small>
507
+ </h2>
508
+
509
+ <ul class="summary">
510
+
511
+ <li class="public ">
512
+ <span class="summary_signature">
513
+
514
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options) &#x21d2; Matchers </a>
515
+
516
+
517
+
518
+ </span>
519
+
520
+
521
+ <span class="note title constructor">constructor</span>
522
+
523
+
524
+
525
+
526
+
527
+ <span class="private note title">private</span>
528
+
529
+
530
+ <span class="summary_desc"><div class='inline'>
531
+ <p>A new instance of Matchers.</p>
532
+ </div></span>
533
+
534
+ </li>
535
+
536
+
537
+ <li class="public ">
538
+ <span class="summary_signature">
539
+
540
+ <a href="#parse_ins-instance_method" title="#parse_ins (instance method)">#<strong>parse_ins</strong>(columns:, row:) &#x21d2; Array&lt;(Array, ScanRow)&gt; </a>
541
+
542
+
543
+
544
+ </span>
545
+
546
+
547
+
548
+
549
+
550
+
551
+ <span class="private note title">private</span>
552
+
553
+
554
+ <span class="summary_desc"><div class='inline'>
555
+ <p>Parse the row&#39;s input columns using the input matchers.</p>
556
+ </div></span>
557
+
558
+ </li>
559
+
560
+
561
+ <li class="public ">
562
+ <span class="summary_signature">
563
+
564
+ <a href="#parse_outs-instance_method" title="#parse_outs (instance method)">#<strong>parse_outs</strong>(columns:, row:) &#x21d2; Array&lt;(Array, ScanRow)&gt; </a>
565
+
566
+
567
+
568
+ </span>
569
+
570
+
571
+
572
+
573
+
574
+
575
+ <span class="private note title">private</span>
576
+
577
+
578
+ <span class="summary_desc"><div class='inline'>
579
+ <p>Parse the row&#39;s output columns using the output matchers.</p>
580
+ </div></span>
581
+
582
+ </li>
583
+
584
+
585
+ </ul>
586
+
587
+
588
+ <div id="constructor_details" class="method_details_list">
589
+ <h2>Constructor Details</h2>
590
+
591
+ <div class="method_details first">
592
+ <h3 class="signature first" id="initialize-instance_method">
593
+
594
+ #<strong>initialize</strong>(options) &#x21d2; <tt><span class='object_link'><a href="" title="CSVDecision::Matchers (class)">Matchers</a></span></tt>
595
+
596
+
597
+
598
+
599
+
600
+ </h3><div class="docstring">
601
+ <div class="discussion">
602
+ <p class="note private">
603
+ <strong>This method is part of a private API.</strong>
604
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
605
+ </p>
606
+
607
+ <p>Returns a new instance of Matchers</p>
608
+
609
+
610
+ </div>
611
+ </div>
612
+ <div class="tags">
613
+ <p class="tag_title">Parameters:</p>
614
+ <ul class="param">
615
+
616
+ <li>
617
+
618
+ <span class='name'>options</span>
619
+
620
+
621
+ <span class='type'>(<tt>Hash{<span class='object_link'><a href="Matchers/Symbol.html" title="CSVDecision::Matchers::Symbol (class)">Symbol</a></span>=&gt;Object}</tt>)</span>
622
+
623
+
624
+
625
+ &mdash;
626
+ <div class='inline'>
627
+ <p>Options hash controlling how the table is parsed and interpreted.</p>
628
+ </div>
629
+
630
+ </li>
631
+
632
+ </ul>
633
+
634
+
635
+ </div><table class="source_code">
636
+ <tr>
637
+ <td>
638
+ <pre class="lines">
639
+
640
+
641
+ 167
642
+ 168
643
+ 169
644
+ 170
645
+ 171</pre>
646
+ </td>
647
+ <td>
648
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 167</span>
649
+
650
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
651
+ <span class='id identifier rubyid_matchers'>matchers</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:matchers</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_klass'>klass</span><span class='op'>|</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
652
+ <span class='ivar'>@ins</span> <span class='op'>=</span> <span class='id identifier rubyid_matchers'>matchers</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:ins?</span><span class='rparen'>)</span>
653
+ <span class='ivar'>@outs</span> <span class='op'>=</span> <span class='id identifier rubyid_matchers'>matchers</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:outs?</span><span class='rparen'>)</span>
654
+ <span class='kw'>end</span></pre>
655
+ </td>
656
+ </tr>
657
+ </table>
658
+ </div>
659
+
660
+ </div>
661
+
662
+ <div id="instance_attr_details" class="attr_details">
663
+ <h2>Instance Attribute Details</h2>
664
+
665
+
666
+ <span id=""></span>
667
+ <div class="method_details first">
668
+ <h3 class="signature first" id="ins-instance_method">
669
+
670
+ #<strong>ins</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt> <span class="extras">(readonly)</span>
671
+
672
+
673
+
674
+
675
+
676
+ </h3><div class="docstring">
677
+ <div class="discussion">
678
+ <p class="note private">
679
+ <strong>This method is part of a private API.</strong>
680
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
681
+ </p>
682
+
683
+ <p>Returns Matchers for the input columns.</p>
684
+
685
+
686
+ </div>
687
+ </div>
688
+ <div class="tags">
689
+
690
+ <p class="tag_title">Returns:</p>
691
+ <ul class="return">
692
+
693
+ <li>
694
+
695
+
696
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt>)</span>
697
+
698
+
699
+
700
+ &mdash;
701
+ <div class='inline'>
702
+ <p>Matchers for the input columns.</p>
703
+ </div>
704
+
705
+ </li>
706
+
707
+ </ul>
708
+
709
+ </div><table class="source_code">
710
+ <tr>
711
+ <td>
712
+ <pre class="lines">
713
+
714
+
715
+ 161
716
+ 162
717
+ 163</pre>
718
+ </td>
719
+ <td>
720
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 161</span>
721
+
722
+ <span class='kw'>def</span> <span class='id identifier rubyid_ins'>ins</span>
723
+ <span class='ivar'>@ins</span>
724
+ <span class='kw'>end</span></pre>
725
+ </td>
726
+ </tr>
727
+ </table>
728
+ </div>
729
+
730
+
731
+ <span id=""></span>
732
+ <div class="method_details ">
733
+ <h3 class="signature " id="outs-instance_method">
734
+
735
+ #<strong>outs</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt> <span class="extras">(readonly)</span>
736
+
737
+
738
+
739
+
740
+
741
+ </h3><div class="docstring">
742
+ <div class="discussion">
743
+ <p class="note private">
744
+ <strong>This method is part of a private API.</strong>
745
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
746
+ </p>
747
+
748
+ <p>Returns Matchers for the output columns.</p>
749
+
750
+
751
+ </div>
752
+ </div>
753
+ <div class="tags">
754
+
755
+ <p class="tag_title">Returns:</p>
756
+ <ul class="return">
757
+
758
+ <li>
759
+
760
+
761
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt>)</span>
762
+
763
+
764
+
765
+ &mdash;
766
+ <div class='inline'>
767
+ <p>Matchers for the output columns.</p>
768
+ </div>
769
+
770
+ </li>
771
+
772
+ </ul>
773
+
774
+ </div><table class="source_code">
775
+ <tr>
776
+ <td>
777
+ <pre class="lines">
778
+
779
+
780
+ 164
781
+ 165
782
+ 166</pre>
783
+ </td>
784
+ <td>
785
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 164</span>
786
+
787
+ <span class='kw'>def</span> <span class='id identifier rubyid_outs'>outs</span>
788
+ <span class='ivar'>@outs</span>
789
+ <span class='kw'>end</span></pre>
790
+ </td>
791
+ </tr>
792
+ </table>
793
+ </div>
794
+
795
+ </div>
796
+
797
+
798
+ <div id="class_method_details" class="method_details_list">
799
+ <h2>Class Method Details</h2>
800
+
801
+
802
+ <div class="method_details first">
803
+ <h3 class="signature first" id="compare?-class_method">
804
+
805
+ .<strong>compare?</strong>(lhs:, compare:, rhs:) &#x21d2; <tt>nil</tt>, <tt>Boolean</tt>
806
+
807
+
808
+
809
+
810
+
811
+ </h3><div class="docstring">
812
+ <div class="discussion">
813
+ <p class="note private">
814
+ <strong>This method is part of a private API.</strong>
815
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
816
+ </p>
817
+
818
+ <p>Compare one object with another if they both respond to the compare method.</p>
819
+
820
+
821
+ </div>
822
+ </div>
823
+ <div class="tags">
824
+ <p class="tag_title">Parameters:</p>
825
+ <ul class="param">
826
+
827
+ <li>
828
+
829
+ <span class='name'>lhs</span>
830
+
831
+
832
+ <span class='type'>(<tt>Object</tt>)</span>
833
+
834
+
835
+
836
+ </li>
837
+
838
+ <li>
839
+
840
+ <span class='name'>compare</span>
841
+
842
+
843
+ <span class='type'>(<tt>Object</tt>)</span>
844
+
845
+
846
+
847
+ </li>
848
+
849
+ <li>
850
+
851
+ <span class='name'>rhs</span>
852
+
853
+
854
+ <span class='type'>(<tt>Object</tt>)</span>
855
+
856
+
857
+
858
+ </li>
859
+
860
+ </ul>
861
+
862
+ <p class="tag_title">Returns:</p>
863
+ <ul class="return">
864
+
865
+ <li>
866
+
867
+
868
+ <span class='type'>(<tt>nil</tt>, <tt>Boolean</tt>)</span>
869
+
870
+
871
+
872
+ </li>
873
+
874
+ </ul>
875
+
876
+ </div><table class="source_code">
877
+ <tr>
878
+ <td>
879
+ <pre class="lines">
880
+
881
+
882
+ 133
883
+ 134
884
+ 135
885
+ 136
886
+ 137
887
+ 138
888
+ 139</pre>
889
+ </td>
890
+ <td>
891
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 133</span>
892
+
893
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_compare?'>compare?</span><span class='lparen'>(</span><span class='label'>lhs:</span><span class='comma'>,</span> <span class='label'>compare:</span><span class='comma'>,</span> <span class='label'>rhs:</span><span class='rparen'>)</span>
894
+ <span class='comment'># Is the rhs the same class or a superclass of lhs, and does rhs respond to the
895
+ </span> <span class='comment'># compare method?
896
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_lhs'>lhs</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_compare'>compare</span><span class='comma'>,</span> <span class='id identifier rubyid_rhs'>rhs</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_lhs'>lhs</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='id identifier rubyid_rhs'>rhs</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_rhs'>rhs</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_compare'>compare</span><span class='rparen'>)</span>
897
+
898
+ <span class='kw'>nil</span>
899
+ <span class='kw'>end</span></pre>
900
+ </td>
901
+ </tr>
902
+ </table>
903
+ </div>
904
+
905
+ <div class="method_details ">
906
+ <h3 class="signature " id="normalize_operator-class_method">
907
+
908
+ .<strong>normalize_operator</strong>(operator) &#x21d2; <tt>String</tt>
909
+
910
+
911
+
912
+
913
+
914
+ </h3><div class="docstring">
915
+ <div class="discussion">
916
+ <p class="note private">
917
+ <strong>This method is part of a private API.</strong>
918
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
919
+ </p>
920
+
921
+ <p>Normalize the operators which are a variation on equals/assignment.</p>
922
+
923
+
924
+ </div>
925
+ </div>
926
+ <div class="tags">
927
+ <p class="tag_title">Parameters:</p>
928
+ <ul class="param">
929
+
930
+ <li>
931
+
932
+ <span class='name'>operator</span>
933
+
934
+
935
+ <span class='type'>(<tt>String</tt>)</span>
936
+
937
+
938
+
939
+ </li>
940
+
941
+ </ul>
942
+
943
+ <p class="tag_title">Returns:</p>
944
+ <ul class="return">
945
+
946
+ <li>
947
+
948
+
949
+ <span class='type'>(<tt>String</tt>)</span>
950
+
951
+
952
+
953
+ </li>
954
+
955
+ </ul>
956
+
957
+ </div><table class="source_code">
958
+ <tr>
959
+ <td>
960
+ <pre class="lines">
961
+
962
+
963
+ 95
964
+ 96
965
+ 97</pre>
966
+ </td>
967
+ <td>
968
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 95</span>
969
+
970
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_operator'>normalize_operator</span><span class='lparen'>(</span><span class='id identifier rubyid_operator'>operator</span><span class='rparen'>)</span>
971
+ <span class='const'><span class='object_link'><a href="#EQUALS_RE-constant" title="CSVDecision::Matchers::EQUALS_RE (constant)">EQUALS_RE</a></span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_operator'>operator</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>==</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='id identifier rubyid_operator'>operator</span>
972
+ <span class='kw'>end</span></pre>
973
+ </td>
974
+ </tr>
975
+ </table>
976
+ </div>
977
+
978
+ <div class="method_details ">
979
+ <h3 class="signature " id="numeric-class_method">
980
+
981
+ .<strong>numeric</strong>(value) &#x21d2; <tt>nil</tt>, ...
982
+
983
+
984
+
985
+
986
+
987
+ </h3><div class="docstring">
988
+ <div class="discussion">
989
+ <p class="note private">
990
+ <strong>This method is part of a private API.</strong>
991
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
992
+ </p>
993
+
994
+ <p>Validate a numeric value and convert it to an Integer or BigDecimal if a
995
+ valid numeric string.</p>
996
+
997
+
998
+ </div>
999
+ </div>
1000
+ <div class="tags">
1001
+ <p class="tag_title">Parameters:</p>
1002
+ <ul class="param">
1003
+
1004
+ <li>
1005
+
1006
+ <span class='name'>value</span>
1007
+
1008
+
1009
+ <span class='type'>(<tt>nil</tt>, <tt>String</tt>, <tt>Integer</tt>, <tt>BigDecimal</tt>)</span>
1010
+
1011
+
1012
+
1013
+ </li>
1014
+
1015
+ </ul>
1016
+
1017
+ <p class="tag_title">Returns:</p>
1018
+ <ul class="return">
1019
+
1020
+ <li>
1021
+
1022
+
1023
+ <span class='type'>(<tt>nil</tt>, <tt>Integer</tt>, <tt>BigDecimal</tt>)</span>
1024
+
1025
+
1026
+
1027
+ </li>
1028
+
1029
+ </ul>
1030
+
1031
+ </div><table class="source_code">
1032
+ <tr>
1033
+ <td>
1034
+ <pre class="lines">
1035
+
1036
+
1037
+ 109
1038
+ 110
1039
+ 111
1040
+ 112
1041
+ 113
1042
+ 114</pre>
1043
+ </td>
1044
+ <td>
1045
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 109</span>
1046
+
1047
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_numeric'>numeric</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1048
+ <span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>BigDecimal</span><span class='rparen'>)</span>
1049
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
1050
+
1051
+ <span class='id identifier rubyid_to_numeric'>to_numeric</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1052
+ <span class='kw'>end</span></pre>
1053
+ </td>
1054
+ </tr>
1055
+ </table>
1056
+ </div>
1057
+
1058
+ <div class="method_details ">
1059
+ <h3 class="signature " id="parse-class_method">
1060
+
1061
+ .<strong>parse</strong>(columns:, matchers:, row:) &#x21d2; <tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>
1062
+
1063
+
1064
+
1065
+
1066
+
1067
+ </h3><div class="docstring">
1068
+ <div class="discussion">
1069
+ <p class="note private">
1070
+ <strong>This method is part of a private API.</strong>
1071
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1072
+ </p>
1073
+
1074
+ <p>Parse the supplied input columns for the row supplied using an array of
1075
+ matchers.</p>
1076
+
1077
+
1078
+ </div>
1079
+ </div>
1080
+ <div class="tags">
1081
+ <p class="tag_title">Parameters:</p>
1082
+ <ul class="param">
1083
+
1084
+ <li>
1085
+
1086
+ <span class='name'>columns</span>
1087
+
1088
+
1089
+ <span class='type'>(<tt>Hash{Integer=&gt;Columns::Entry}</tt>)</span>
1090
+
1091
+
1092
+
1093
+ &mdash;
1094
+ <div class='inline'>
1095
+ <p>Input columns hash.</p>
1096
+ </div>
1097
+
1098
+ </li>
1099
+
1100
+ <li>
1101
+
1102
+ <span class='name'>matchers</span>
1103
+
1104
+
1105
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt>)</span>
1106
+
1107
+
1108
+
1109
+ </li>
1110
+
1111
+ <li>
1112
+
1113
+ <span class='name'>row</span>
1114
+
1115
+
1116
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
1117
+
1118
+
1119
+
1120
+ &mdash;
1121
+ <div class='inline'>
1122
+ <p>Data row being parsed.</p>
1123
+ </div>
1124
+
1125
+ </li>
1126
+
1127
+ </ul>
1128
+
1129
+ <p class="tag_title">Returns:</p>
1130
+ <ul class="return">
1131
+
1132
+ <li>
1133
+
1134
+
1135
+ <span class='type'>(<tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>)</span>
1136
+
1137
+
1138
+
1139
+ &mdash;
1140
+ <div class='inline'>
1141
+ <p>Used to scan a table row against an input hash for matches.</p>
1142
+ </div>
1143
+
1144
+ </li>
1145
+
1146
+ </ul>
1147
+
1148
+ </div><table class="source_code">
1149
+ <tr>
1150
+ <td>
1151
+ <pre class="lines">
1152
+
1153
+
1154
+ 147
1155
+ 148
1156
+ 149
1157
+ 150
1158
+ 151
1159
+ 152
1160
+ 153
1161
+ 154
1162
+ 155
1163
+ 156
1164
+ 157
1165
+ 158</pre>
1166
+ </td>
1167
+ <td>
1168
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 147</span>
1169
+
1170
+ <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'>columns:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='comma'>,</span> <span class='label'>row:</span><span class='rparen'>)</span>
1171
+ <span class='comment'># Build an array of column indexes requiring simple constant matches,
1172
+ </span> <span class='comment'># and a second array of columns requiring special matchers.
1173
+ </span> <span class='id identifier rubyid_scan_row'>scan_row</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ScanRow.html#initialize-instance_method" title="CSVDecision::ScanRow#initialize (method)">new</a></span></span>
1174
+
1175
+ <span class='comment'># Scan the columns in the data row, and build an object to scan this row against
1176
+ </span> <span class='comment'># an input hash.
1177
+ </span> <span class='comment'># Convert values in the data row if not just a simple constant.
1178
+ </span> <span class='id identifier rubyid_row'>row</span> <span class='op'>=</span> <span class='id identifier rubyid_scan_row'>scan_row</span><span class='period'>.</span><span class='id identifier rubyid_scan_columns'>scan_columns</span><span class='lparen'>(</span><span class='label'>columns:</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='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1179
+
1180
+ <span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_scan_row'>scan_row</span><span class='rbracket'>]</span>
1181
+ <span class='kw'>end</span></pre>
1182
+ </td>
1183
+ </tr>
1184
+ </table>
1185
+ </div>
1186
+
1187
+ <div class="method_details ">
1188
+ <h3 class="signature " id="regexp-class_method">
1189
+
1190
+ .<strong>regexp</strong>(value) &#x21d2; <tt>Regexp</tt>
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+ </h3><div class="docstring">
1197
+ <div class="discussion">
1198
+ <p class="note private">
1199
+ <strong>This method is part of a private API.</strong>
1200
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1201
+ </p>
1202
+
1203
+ <p>All regular expressions used for matching are anchored inside their own
1204
+ non-capturing group.</p>
1205
+
1206
+
1207
+ </div>
1208
+ </div>
1209
+ <div class="tags">
1210
+ <p class="tag_title">Parameters:</p>
1211
+ <ul class="param">
1212
+
1213
+ <li>
1214
+
1215
+ <span class='name'>value</span>
1216
+
1217
+
1218
+ <span class='type'>(<tt>String</tt>)</span>
1219
+
1220
+
1221
+
1222
+ &mdash;
1223
+ <div class='inline'>
1224
+ <p>String used to form an anchored regular expression.</p>
1225
+ </div>
1226
+
1227
+ </li>
1228
+
1229
+ </ul>
1230
+
1231
+ <p class="tag_title">Returns:</p>
1232
+ <ul class="return">
1233
+
1234
+ <li>
1235
+
1236
+
1237
+ <span class='type'>(<tt>Regexp</tt>)</span>
1238
+
1239
+
1240
+
1241
+ &mdash;
1242
+ <div class='inline'>
1243
+ <p>Anchored, frozen regular expression.</p>
1244
+ </div>
1245
+
1246
+ </li>
1247
+
1248
+ </ul>
1249
+
1250
+ </div><table class="source_code">
1251
+ <tr>
1252
+ <td>
1253
+ <pre class="lines">
1254
+
1255
+
1256
+ 71
1257
+ 72
1258
+ 73</pre>
1259
+ </td>
1260
+ <td>
1261
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 71</span>
1262
+
1263
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_regexp'>regexp</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1264
+ <span class='const'>Regexp</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\A(?:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'>)\\z</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
1265
+ <span class='kw'>end</span></pre>
1266
+ </td>
1267
+ </tr>
1268
+ </table>
1269
+ </div>
1270
+
1271
+ <div class="method_details ">
1272
+ <h3 class="signature " id="to_numeric-class_method">
1273
+
1274
+ .<strong>to_numeric</strong>(value) &#x21d2; <tt>nil</tt>, ...
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+ </h3><div class="docstring">
1281
+ <div class="discussion">
1282
+ <p class="note private">
1283
+ <strong>This method is part of a private API.</strong>
1284
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1285
+ </p>
1286
+
1287
+ <p>Convert a numeric string into an Integer or BigDecimal, otherwise return
1288
+ nil.</p>
1289
+
1290
+
1291
+ </div>
1292
+ </div>
1293
+ <div class="tags">
1294
+ <p class="tag_title">Parameters:</p>
1295
+ <ul class="param">
1296
+
1297
+ <li>
1298
+
1299
+ <span class='name'>value</span>
1300
+
1301
+
1302
+ <span class='type'>(<tt>String</tt>)</span>
1303
+
1304
+
1305
+
1306
+ </li>
1307
+
1308
+ </ul>
1309
+
1310
+ <p class="tag_title">Returns:</p>
1311
+ <ul class="return">
1312
+
1313
+ <li>
1314
+
1315
+
1316
+ <span class='type'>(<tt>nil</tt>, <tt>Integer</tt>, <tt>BigDecimal</tt>)</span>
1317
+
1318
+
1319
+
1320
+ </li>
1321
+
1322
+ </ul>
1323
+
1324
+ </div><table class="source_code">
1325
+ <tr>
1326
+ <td>
1327
+ <pre class="lines">
1328
+
1329
+
1330
+ 120
1331
+ 121
1332
+ 122
1333
+ 123
1334
+ 124
1335
+ 125</pre>
1336
+ </td>
1337
+ <td>
1338
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 120</span>
1339
+
1340
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_numeric'>to_numeric</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1341
+ <span class='kw'>return</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'>NUMERIC_RE</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='rparen'>)</span>
1342
+
1343
+ <span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='kw'>if</span> <span class='id identifier rubyid_match'>match</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>decimal</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1344
+ <span class='const'>BigDecimal</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_chomp'>chomp</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1345
+ <span class='kw'>end</span></pre>
1346
+ </td>
1347
+ </tr>
1348
+ </table>
1349
+ </div>
1350
+
1351
+ </div>
1352
+
1353
+ <div id="instance_method_details" class="method_details_list">
1354
+ <h2>Instance Method Details</h2>
1355
+
1356
+
1357
+ <div class="method_details first">
1358
+ <h3 class="signature first" id="parse_ins-instance_method">
1359
+
1360
+ #<strong>parse_ins</strong>(columns:, row:) &#x21d2; <tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>
1361
+
1362
+
1363
+
1364
+
1365
+
1366
+ </h3><div class="docstring">
1367
+ <div class="discussion">
1368
+ <p class="note private">
1369
+ <strong>This method is part of a private API.</strong>
1370
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1371
+ </p>
1372
+
1373
+ <p>Parse the row&#39;s input columns using the input matchers.</p>
1374
+
1375
+
1376
+ </div>
1377
+ </div>
1378
+ <div class="tags">
1379
+ <p class="tag_title">Parameters:</p>
1380
+ <ul class="param">
1381
+
1382
+ <li>
1383
+
1384
+ <span class='name'>columns</span>
1385
+
1386
+
1387
+ <span class='type'>(<tt>Hash{Integer=&gt;Columns::Entry}</tt>)</span>
1388
+
1389
+
1390
+
1391
+ &mdash;
1392
+ <div class='inline'>
1393
+ <p>Input columns hash.</p>
1394
+ </div>
1395
+
1396
+ </li>
1397
+
1398
+ <li>
1399
+
1400
+ <span class='name'>row</span>
1401
+
1402
+
1403
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
1404
+
1405
+
1406
+
1407
+ &mdash;
1408
+ <div class='inline'>
1409
+ <p>Data row being parsed.</p>
1410
+ </div>
1411
+
1412
+ </li>
1413
+
1414
+ </ul>
1415
+
1416
+ <p class="tag_title">Returns:</p>
1417
+ <ul class="return">
1418
+
1419
+ <li>
1420
+
1421
+
1422
+ <span class='type'>(<tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>)</span>
1423
+
1424
+
1425
+
1426
+ &mdash;
1427
+ <div class='inline'>
1428
+ <p>Used to scan a table row against an input hash for matches.</p>
1429
+ </div>
1430
+
1431
+ </li>
1432
+
1433
+ </ul>
1434
+
1435
+ </div><table class="source_code">
1436
+ <tr>
1437
+ <td>
1438
+ <pre class="lines">
1439
+
1440
+
1441
+ 178
1442
+ 179
1443
+ 180</pre>
1444
+ </td>
1445
+ <td>
1446
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 178</span>
1447
+
1448
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_ins'>parse_ins</span><span class='lparen'>(</span><span class='label'>columns:</span><span class='comma'>,</span> <span class='label'>row:</span><span class='rparen'>)</span>
1449
+ <span class='const'><span class='object_link'><a href="" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="#parse-class_method" title="CSVDecision::Matchers.parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='label'>columns:</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='label'>matchers:</span> <span class='ivar'>@ins</span><span class='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1450
+ <span class='kw'>end</span></pre>
1451
+ </td>
1452
+ </tr>
1453
+ </table>
1454
+ </div>
1455
+
1456
+ <div class="method_details ">
1457
+ <h3 class="signature " id="parse_outs-instance_method">
1458
+
1459
+ #<strong>parse_outs</strong>(columns:, row:) &#x21d2; <tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>
1460
+
1461
+
1462
+
1463
+
1464
+
1465
+ </h3><div class="docstring">
1466
+ <div class="discussion">
1467
+ <p class="note private">
1468
+ <strong>This method is part of a private API.</strong>
1469
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
1470
+ </p>
1471
+
1472
+ <p>Parse the row&#39;s output columns using the output matchers.</p>
1473
+
1474
+
1475
+ </div>
1476
+ </div>
1477
+ <div class="tags">
1478
+ <p class="tag_title">Parameters:</p>
1479
+ <ul class="param">
1480
+
1481
+ <li>
1482
+
1483
+ <span class='name'>columns</span>
1484
+
1485
+
1486
+ <span class='type'>(<tt>Hash{Integer=&gt;Columns::Entry}</tt>)</span>
1487
+
1488
+
1489
+
1490
+ &mdash;
1491
+ <div class='inline'>
1492
+ <p>Input columns hash.</p>
1493
+ </div>
1494
+
1495
+ </li>
1496
+
1497
+ <li>
1498
+
1499
+ <span class='name'>row</span>
1500
+
1501
+
1502
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
1503
+
1504
+
1505
+
1506
+ &mdash;
1507
+ <div class='inline'>
1508
+ <p>Data row being parsed.</p>
1509
+ </div>
1510
+
1511
+ </li>
1512
+
1513
+ </ul>
1514
+
1515
+ <p class="tag_title">Returns:</p>
1516
+ <ul class="return">
1517
+
1518
+ <li>
1519
+
1520
+
1521
+ <span class='type'>(<tt>Array&lt;(Array, <span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">ScanRow</a></span>)&gt;</tt>)</span>
1522
+
1523
+
1524
+
1525
+ &mdash;
1526
+ <div class='inline'>
1527
+ <p>Used to scan a table row against an input hash for matches.</p>
1528
+ </div>
1529
+
1530
+ </li>
1531
+
1532
+ </ul>
1533
+
1534
+ </div><table class="source_code">
1535
+ <tr>
1536
+ <td>
1537
+ <pre class="lines">
1538
+
1539
+
1540
+ 187
1541
+ 188
1542
+ 189</pre>
1543
+ </td>
1544
+ <td>
1545
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers.rb', line 187</span>
1546
+
1547
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_outs'>parse_outs</span><span class='lparen'>(</span><span class='label'>columns:</span><span class='comma'>,</span> <span class='label'>row:</span><span class='rparen'>)</span>
1548
+ <span class='const'><span class='object_link'><a href="" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="#parse-class_method" title="CSVDecision::Matchers.parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='label'>columns:</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='label'>matchers:</span> <span class='ivar'>@outs</span><span class='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
1549
+ <span class='kw'>end</span></pre>
1550
+ </td>
1551
+ </tr>
1552
+ </table>
1553
+ </div>
1554
+
1555
+ </div>
1556
+
1557
+ </div>
1558
+
1559
+ <div id="footer">
1560
+ Generated on Sun Feb 11 10:26:07 2018 by
1561
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1562
+ 0.9.12 (ruby-2.4.0).
1563
+ </div>
1564
+
1565
+ </div>
1566
+ </body>
1567
+ </html>