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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +3 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +85 -0
- data/Dockerfile +6 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +356 -0
- data/benchmarks/rufus_decision.rb +158 -0
- data/csv_decision2.gemspec +38 -0
- data/doc/CSVDecision/CellValidationError.html +143 -0
- data/doc/CSVDecision/Columns/Default.html +589 -0
- data/doc/CSVDecision/Columns/Dictionary.html +801 -0
- data/doc/CSVDecision/Columns/Entry.html +508 -0
- data/doc/CSVDecision/Columns.html +1259 -0
- data/doc/CSVDecision/Constant.html +254 -0
- data/doc/CSVDecision/Data.html +479 -0
- data/doc/CSVDecision/Decide.html +302 -0
- data/doc/CSVDecision/Decision.html +1011 -0
- data/doc/CSVDecision/Defaults.html +291 -0
- data/doc/CSVDecision/Dictionary/Entry.html +1147 -0
- data/doc/CSVDecision/Dictionary.html +426 -0
- data/doc/CSVDecision/Error.html +139 -0
- data/doc/CSVDecision/FileError.html +143 -0
- data/doc/CSVDecision/Function.html +240 -0
- data/doc/CSVDecision/Guard.html +245 -0
- data/doc/CSVDecision/Header.html +647 -0
- data/doc/CSVDecision/Index.html +741 -0
- data/doc/CSVDecision/Input.html +404 -0
- data/doc/CSVDecision/Load.html +296 -0
- data/doc/CSVDecision/Matchers/Constant.html +484 -0
- data/doc/CSVDecision/Matchers/Function.html +511 -0
- data/doc/CSVDecision/Matchers/Guard.html +503 -0
- data/doc/CSVDecision/Matchers/Matcher.html +507 -0
- data/doc/CSVDecision/Matchers/Numeric.html +415 -0
- data/doc/CSVDecision/Matchers/Pattern.html +491 -0
- data/doc/CSVDecision/Matchers/Proc.html +704 -0
- data/doc/CSVDecision/Matchers/Range.html +379 -0
- data/doc/CSVDecision/Matchers/Symbol.html +426 -0
- data/doc/CSVDecision/Matchers.html +1567 -0
- data/doc/CSVDecision/Numeric.html +259 -0
- data/doc/CSVDecision/Options.html +443 -0
- data/doc/CSVDecision/Parse.html +282 -0
- data/doc/CSVDecision/Paths.html +742 -0
- data/doc/CSVDecision/Result.html +1200 -0
- data/doc/CSVDecision/Scan/InputHashes.html +369 -0
- data/doc/CSVDecision/Scan.html +313 -0
- data/doc/CSVDecision/ScanRow.html +866 -0
- data/doc/CSVDecision/Symbol.html +256 -0
- data/doc/CSVDecision/Table.html +1470 -0
- data/doc/CSVDecision/TableValidationError.html +143 -0
- data/doc/CSVDecision/Validate.html +422 -0
- data/doc/CSVDecision.html +621 -0
- data/doc/_index.html +471 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +499 -0
- data/doc/file.README.html +421 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +421 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1163 -0
- data/doc/top-level-namespace.html +110 -0
- data/docker-compose.yml +13 -0
- data/lib/csv_decision/columns.rb +192 -0
- data/lib/csv_decision/data.rb +92 -0
- data/lib/csv_decision/decision.rb +196 -0
- data/lib/csv_decision/defaults.rb +47 -0
- data/lib/csv_decision/dictionary.rb +180 -0
- data/lib/csv_decision/header.rb +83 -0
- data/lib/csv_decision/index.rb +107 -0
- data/lib/csv_decision/input.rb +121 -0
- data/lib/csv_decision/load.rb +36 -0
- data/lib/csv_decision/matchers/constant.rb +74 -0
- data/lib/csv_decision/matchers/function.rb +56 -0
- data/lib/csv_decision/matchers/guard.rb +142 -0
- data/lib/csv_decision/matchers/numeric.rb +44 -0
- data/lib/csv_decision/matchers/pattern.rb +94 -0
- data/lib/csv_decision/matchers/range.rb +95 -0
- data/lib/csv_decision/matchers/symbol.rb +149 -0
- data/lib/csv_decision/matchers.rb +220 -0
- data/lib/csv_decision/options.rb +124 -0
- data/lib/csv_decision/parse.rb +165 -0
- data/lib/csv_decision/paths.rb +78 -0
- data/lib/csv_decision/result.rb +204 -0
- data/lib/csv_decision/scan.rb +117 -0
- data/lib/csv_decision/scan_row.rb +142 -0
- data/lib/csv_decision/table.rb +101 -0
- data/lib/csv_decision/validate.rb +85 -0
- data/lib/csv_decision.rb +45 -0
- data/spec/csv_decision/columns_spec.rb +251 -0
- data/spec/csv_decision/constant_spec.rb +36 -0
- data/spec/csv_decision/data_spec.rb +50 -0
- data/spec/csv_decision/decision_spec.rb +19 -0
- data/spec/csv_decision/examples_spec.rb +242 -0
- data/spec/csv_decision/index_spec.rb +58 -0
- data/spec/csv_decision/input_spec.rb +55 -0
- data/spec/csv_decision/load_spec.rb +28 -0
- data/spec/csv_decision/matchers/function_spec.rb +82 -0
- data/spec/csv_decision/matchers/guard_spec.rb +170 -0
- data/spec/csv_decision/matchers/numeric_spec.rb +47 -0
- data/spec/csv_decision/matchers/pattern_spec.rb +183 -0
- data/spec/csv_decision/matchers/range_spec.rb +70 -0
- data/spec/csv_decision/matchers/symbol_spec.rb +67 -0
- data/spec/csv_decision/options_spec.rb +94 -0
- data/spec/csv_decision/parse_spec.rb +44 -0
- data/spec/csv_decision/table_spec.rb +683 -0
- data/spec/csv_decision_spec.rb +7 -0
- data/spec/data/invalid/empty.csv +0 -0
- data/spec/data/invalid/invalid_header1.csv +4 -0
- data/spec/data/invalid/invalid_header2.csv +4 -0
- data/spec/data/invalid/invalid_header3.csv +4 -0
- data/spec/data/invalid/invalid_header4.csv +4 -0
- data/spec/data/valid/benchmark_regexp.csv +10 -0
- data/spec/data/valid/index_example.csv +13 -0
- data/spec/data/valid/multi_column_index.csv +10 -0
- data/spec/data/valid/multi_column_index2.csv +12 -0
- data/spec/data/valid/options_in_file1.csv +5 -0
- data/spec/data/valid/options_in_file2.csv +5 -0
- data/spec/data/valid/options_in_file3.csv +13 -0
- data/spec/data/valid/regular_expressions.csv +11 -0
- data/spec/data/valid/simple_constants.csv +5 -0
- data/spec/data/valid/simple_example.csv +10 -0
- data/spec/data/valid/valid.csv +4 -0
- data/spec/spec_helper.rb +106 -0
- metadata +352 -0
@@ -0,0 +1,866 @@
|
|
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::ScanRow
|
8
|
+
|
9
|
+
— 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::ScanRow";
|
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 (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ScanRow</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::ScanRow
|
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::ScanRow</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/scan_row.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>Data row object indicating which columns are constants versus procs.</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="#constants-instance_method" title="#constants (instance method)">#<strong>constants</strong> ⇒ Array<Integer> </a>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</span>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<span class="private note title">private</span>
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc"><div class='inline'>
|
145
|
+
<p>Column indices for simple constants.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#procs-instance_method" title="#procs (instance method)">#<strong>procs</strong> ⇒ Array<Integer> </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<span class="note title readonly">readonly</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<span class="private note title">private</span>
|
171
|
+
|
172
|
+
|
173
|
+
<span class="summary_desc"><div class='inline'>
|
174
|
+
<p>Column indices for Proc objects.</p>
|
175
|
+
</div></span>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
</ul>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<h2>
|
187
|
+
Class Method Summary
|
188
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
189
|
+
</h2>
|
190
|
+
|
191
|
+
<ul class="summary">
|
192
|
+
|
193
|
+
<li class="public ">
|
194
|
+
<span class="summary_signature">
|
195
|
+
|
196
|
+
<a href="#scan-class_method" title="scan (class method)">.<strong>scan</strong>(column:, matchers:, cell:) ⇒ false, Matchers::Proc </a>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
</span>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="private note title">private</span>
|
208
|
+
|
209
|
+
|
210
|
+
<span class="summary_desc"><div class='inline'>
|
211
|
+
<p>Scan the table cell against all matches.</p>
|
212
|
+
</div></span>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
</ul>
|
218
|
+
|
219
|
+
<h2>
|
220
|
+
Instance Method Summary
|
221
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
222
|
+
</h2>
|
223
|
+
|
224
|
+
<ul class="summary">
|
225
|
+
|
226
|
+
<li class="public ">
|
227
|
+
<span class="summary_signature">
|
228
|
+
|
229
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ ScanRow </a>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
</span>
|
234
|
+
|
235
|
+
|
236
|
+
<span class="note title constructor">constructor</span>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="private note title">private</span>
|
243
|
+
|
244
|
+
|
245
|
+
<span class="summary_desc"><div class='inline'>
|
246
|
+
<p>A new instance of ScanRow.</p>
|
247
|
+
</div></span>
|
248
|
+
|
249
|
+
</li>
|
250
|
+
|
251
|
+
|
252
|
+
<li class="public ">
|
253
|
+
<span class="summary_signature">
|
254
|
+
|
255
|
+
<a href="#match%3F-instance_method" title="#match? (instance method)">#<strong>match?</strong>(row:, scan_cols:, hash:) ⇒ Boolean </a>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
</span>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="private note title">private</span>
|
267
|
+
|
268
|
+
|
269
|
+
<span class="summary_desc"><div class='inline'>
|
270
|
+
<p>Match cells in the input hash against a decision table row.</p>
|
271
|
+
</div></span>
|
272
|
+
|
273
|
+
</li>
|
274
|
+
|
275
|
+
|
276
|
+
<li class="public ">
|
277
|
+
<span class="summary_signature">
|
278
|
+
|
279
|
+
<a href="#scan_columns-instance_method" title="#scan_columns (instance method)">#<strong>scan_columns</strong>(row:, columns:, matchers:) ⇒ Array </a>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</span>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="private note title">private</span>
|
291
|
+
|
292
|
+
|
293
|
+
<span class="summary_desc"><div class='inline'>
|
294
|
+
<p>Scan all the specified <code>columns</code> (e.g., inputs) in the given
|
295
|
+
<code>data</code> row using the <code>matchers</code> array supplied.</p>
|
296
|
+
</div></span>
|
297
|
+
|
298
|
+
</li>
|
299
|
+
|
300
|
+
|
301
|
+
</ul>
|
302
|
+
|
303
|
+
|
304
|
+
<div id="constructor_details" class="method_details_list">
|
305
|
+
<h2>Constructor Details</h2>
|
306
|
+
|
307
|
+
<div class="method_details first">
|
308
|
+
<h3 class="signature first" id="initialize-instance_method">
|
309
|
+
|
310
|
+
#<strong>initialize</strong> ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::ScanRow (class)">ScanRow</a></span></tt>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
</h3><div class="docstring">
|
317
|
+
<div class="discussion">
|
318
|
+
<p class="note private">
|
319
|
+
<strong>This method is part of a private API.</strong>
|
320
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
321
|
+
</p>
|
322
|
+
|
323
|
+
<p>Returns a new instance of ScanRow</p>
|
324
|
+
|
325
|
+
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
<div class="tags">
|
329
|
+
|
330
|
+
|
331
|
+
</div><table class="source_code">
|
332
|
+
<tr>
|
333
|
+
<td>
|
334
|
+
<pre class="lines">
|
335
|
+
|
336
|
+
|
337
|
+
72
|
338
|
+
73
|
339
|
+
74
|
340
|
+
75</pre>
|
341
|
+
</td>
|
342
|
+
<td>
|
343
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 72</span>
|
344
|
+
|
345
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
346
|
+
<span class='ivar'>@constants</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
347
|
+
<span class='ivar'>@procs</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
348
|
+
<span class='kw'>end</span></pre>
|
349
|
+
</td>
|
350
|
+
</tr>
|
351
|
+
</table>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div id="instance_attr_details" class="attr_details">
|
357
|
+
<h2>Instance Attribute Details</h2>
|
358
|
+
|
359
|
+
|
360
|
+
<span id="constants=-instance_method"></span>
|
361
|
+
<div class="method_details first">
|
362
|
+
<h3 class="signature first" id="constants-instance_method">
|
363
|
+
|
364
|
+
#<strong>constants</strong> ⇒ <tt>Array<Integer></tt>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
</h3><div class="docstring">
|
371
|
+
<div class="discussion">
|
372
|
+
<p class="note private">
|
373
|
+
<strong>This method is part of a private API.</strong>
|
374
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
375
|
+
</p>
|
376
|
+
|
377
|
+
<p>Returns Column indices for simple constants.</p>
|
378
|
+
|
379
|
+
|
380
|
+
</div>
|
381
|
+
</div>
|
382
|
+
<div class="tags">
|
383
|
+
|
384
|
+
<p class="tag_title">Returns:</p>
|
385
|
+
<ul class="return">
|
386
|
+
|
387
|
+
<li>
|
388
|
+
|
389
|
+
|
390
|
+
<span class='type'>(<tt>Array<Integer></tt>)</span>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
—
|
395
|
+
<div class='inline'>
|
396
|
+
<p>Column indices for simple constants.</p>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
</li>
|
400
|
+
|
401
|
+
</ul>
|
402
|
+
|
403
|
+
</div><table class="source_code">
|
404
|
+
<tr>
|
405
|
+
<td>
|
406
|
+
<pre class="lines">
|
407
|
+
|
408
|
+
|
409
|
+
67
|
410
|
+
68
|
411
|
+
69</pre>
|
412
|
+
</td>
|
413
|
+
<td>
|
414
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 67</span>
|
415
|
+
|
416
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_constants'>constants</span>
|
417
|
+
<span class='ivar'>@constants</span>
|
418
|
+
<span class='kw'>end</span></pre>
|
419
|
+
</td>
|
420
|
+
</tr>
|
421
|
+
</table>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
|
425
|
+
<span id=""></span>
|
426
|
+
<div class="method_details ">
|
427
|
+
<h3 class="signature " id="procs-instance_method">
|
428
|
+
|
429
|
+
#<strong>procs</strong> ⇒ <tt>Array<Integer></tt> <span class="extras">(readonly)</span>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
</h3><div class="docstring">
|
436
|
+
<div class="discussion">
|
437
|
+
<p class="note private">
|
438
|
+
<strong>This method is part of a private API.</strong>
|
439
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
440
|
+
</p>
|
441
|
+
|
442
|
+
<p>Returns Column indices for Proc objects.</p>
|
443
|
+
|
444
|
+
|
445
|
+
</div>
|
446
|
+
</div>
|
447
|
+
<div class="tags">
|
448
|
+
|
449
|
+
<p class="tag_title">Returns:</p>
|
450
|
+
<ul class="return">
|
451
|
+
|
452
|
+
<li>
|
453
|
+
|
454
|
+
|
455
|
+
<span class='type'>(<tt>Array<Integer></tt>)</span>
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
—
|
460
|
+
<div class='inline'>
|
461
|
+
<p>Column indices for Proc objects.</p>
|
462
|
+
</div>
|
463
|
+
|
464
|
+
</li>
|
465
|
+
|
466
|
+
</ul>
|
467
|
+
|
468
|
+
</div><table class="source_code">
|
469
|
+
<tr>
|
470
|
+
<td>
|
471
|
+
<pre class="lines">
|
472
|
+
|
473
|
+
|
474
|
+
70
|
475
|
+
71
|
476
|
+
72</pre>
|
477
|
+
</td>
|
478
|
+
<td>
|
479
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 70</span>
|
480
|
+
|
481
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_procs'>procs</span>
|
482
|
+
<span class='ivar'>@procs</span>
|
483
|
+
<span class='kw'>end</span></pre>
|
484
|
+
</td>
|
485
|
+
</tr>
|
486
|
+
</table>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</div>
|
490
|
+
|
491
|
+
|
492
|
+
<div id="class_method_details" class="method_details_list">
|
493
|
+
<h2>Class Method Details</h2>
|
494
|
+
|
495
|
+
|
496
|
+
<div class="method_details first">
|
497
|
+
<h3 class="signature first" id="scan-class_method">
|
498
|
+
|
499
|
+
.<strong>scan</strong>(column:, matchers:, cell:) ⇒ <tt>false</tt>, <tt><span class='object_link'><a href="Matchers/Proc.html" title="CSVDecision::Matchers::Proc (class)">Matchers::Proc</a></span></tt>
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
</h3><div class="docstring">
|
506
|
+
<div class="discussion">
|
507
|
+
<p class="note private">
|
508
|
+
<strong>This method is part of a private API.</strong>
|
509
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
510
|
+
</p>
|
511
|
+
|
512
|
+
<p>Scan the table cell against all matches.</p>
|
513
|
+
|
514
|
+
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
<div class="tags">
|
518
|
+
<p class="tag_title">Parameters:</p>
|
519
|
+
<ul class="param">
|
520
|
+
|
521
|
+
<li>
|
522
|
+
|
523
|
+
<span class='name'>column</span>
|
524
|
+
|
525
|
+
|
526
|
+
<span class='type'>(<tt><span class='object_link'><a href="Dictionary/Entry.html" title="CSVDecision::Dictionary::Entry (class)">Dictionary::Entry</a></span></tt>)</span>
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
—
|
531
|
+
<div class='inline'>
|
532
|
+
<p>Column dictionary entry.</p>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
</li>
|
536
|
+
|
537
|
+
<li>
|
538
|
+
|
539
|
+
<span class='name'>matchers</span>
|
540
|
+
|
541
|
+
|
542
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>></tt>)</span>
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
</li>
|
547
|
+
|
548
|
+
<li>
|
549
|
+
|
550
|
+
<span class='name'>cell</span>
|
551
|
+
|
552
|
+
|
553
|
+
<span class='type'>(<tt>String</tt>)</span>
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
</li>
|
558
|
+
|
559
|
+
</ul>
|
560
|
+
|
561
|
+
<p class="tag_title">Returns:</p>
|
562
|
+
<ul class="return">
|
563
|
+
|
564
|
+
<li>
|
565
|
+
|
566
|
+
|
567
|
+
<span class='type'>(<tt>false</tt>, <tt><span class='object_link'><a href="Matchers/Proc.html" title="CSVDecision::Matchers::Proc (class)">Matchers::Proc</a></span></tt>)</span>
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
</li>
|
572
|
+
|
573
|
+
</ul>
|
574
|
+
|
575
|
+
</div><table class="source_code">
|
576
|
+
<tr>
|
577
|
+
<td>
|
578
|
+
<pre class="lines">
|
579
|
+
|
580
|
+
|
581
|
+
21
|
582
|
+
22
|
583
|
+
23
|
584
|
+
24
|
585
|
+
25
|
586
|
+
26
|
587
|
+
27
|
588
|
+
28
|
589
|
+
29</pre>
|
590
|
+
</td>
|
591
|
+
<td>
|
592
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 21</span>
|
593
|
+
|
594
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='label'>column:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='comma'>,</span> <span class='label'>cell:</span><span class='rparen'>)</span>
|
595
|
+
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_cell'>cell</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
596
|
+
|
597
|
+
<span class='id identifier rubyid_proc'>proc</span> <span class='op'>=</span> <span class='id identifier rubyid_scan_matchers'>scan_matchers</span><span class='lparen'>(</span><span class='label'>column:</span> <span class='id identifier rubyid_column'>column</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'>cell:</span> <span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
|
598
|
+
<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>
|
599
|
+
|
600
|
+
<span class='comment'># Must be a simple string constant - this is OK except for a certain column types.
|
601
|
+
</span> <span class='id identifier rubyid_invalid_constant?'>invalid_constant?</span><span class='lparen'>(</span><span class='label'>type:</span> <span class='symbol'>:constant</span><span class='comma'>,</span> <span class='label'>column:</span> <span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
|
602
|
+
<span class='kw'>end</span></pre>
|
603
|
+
</td>
|
604
|
+
</tr>
|
605
|
+
</table>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
</div>
|
609
|
+
|
610
|
+
<div id="instance_method_details" class="method_details_list">
|
611
|
+
<h2>Instance Method Details</h2>
|
612
|
+
|
613
|
+
|
614
|
+
<div class="method_details first">
|
615
|
+
<h3 class="signature first" id="match?-instance_method">
|
616
|
+
|
617
|
+
#<strong>match?</strong>(row:, scan_cols:, hash:) ⇒ <tt>Boolean</tt>
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</h3><div class="docstring">
|
624
|
+
<div class="discussion">
|
625
|
+
<p class="note private">
|
626
|
+
<strong>This method is part of a private API.</strong>
|
627
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
628
|
+
</p>
|
629
|
+
|
630
|
+
<p>Match cells in the input hash against a decision table row.</p>
|
631
|
+
|
632
|
+
|
633
|
+
</div>
|
634
|
+
</div>
|
635
|
+
<div class="tags">
|
636
|
+
<p class="tag_title">Parameters:</p>
|
637
|
+
<ul class="param">
|
638
|
+
|
639
|
+
<li>
|
640
|
+
|
641
|
+
<span class='name'>row</span>
|
642
|
+
|
643
|
+
|
644
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
—
|
649
|
+
<div class='inline'>
|
650
|
+
<p>Data row - still just all string constants.</p>
|
651
|
+
</div>
|
652
|
+
|
653
|
+
</li>
|
654
|
+
|
655
|
+
</ul>
|
656
|
+
|
657
|
+
<p class="tag_title">Returns:</p>
|
658
|
+
<ul class="return">
|
659
|
+
|
660
|
+
<li>
|
661
|
+
|
662
|
+
|
663
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
—
|
668
|
+
<div class='inline'>
|
669
|
+
<p>True for a match, false otherwise.</p>
|
670
|
+
</div>
|
671
|
+
|
672
|
+
</li>
|
673
|
+
|
674
|
+
</ul>
|
675
|
+
|
676
|
+
</div><table class="source_code">
|
677
|
+
<tr>
|
678
|
+
<td>
|
679
|
+
<pre class="lines">
|
680
|
+
|
681
|
+
|
682
|
+
108
|
683
|
+
109
|
684
|
+
110
|
685
|
+
111
|
686
|
+
112
|
687
|
+
113
|
688
|
+
114
|
689
|
+
115</pre>
|
690
|
+
</td>
|
691
|
+
<td>
|
692
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 108</span>
|
693
|
+
|
694
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='label'>row:</span><span class='comma'>,</span> <span class='label'>scan_cols:</span><span class='comma'>,</span> <span class='label'>hash:</span><span class='rparen'>)</span>
|
695
|
+
<span class='comment'># Check any table row cell constants first, and maybe fail fast...
|
696
|
+
</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='ivar'>@constants</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</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='op'>!=</span> <span class='id identifier rubyid_scan_cols'>scan_cols</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
697
|
+
|
698
|
+
<span class='comment'># These table row cells are Proc objects which need evaluating and
|
699
|
+
</span> <span class='comment'># must all return a truthy value.
|
700
|
+
</span> <span class='ivar'>@procs</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</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='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='label'>value:</span> <span class='id identifier rubyid_scan_cols'>scan_cols</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>hash:</span> <span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
701
|
+
<span class='kw'>end</span></pre>
|
702
|
+
</td>
|
703
|
+
</tr>
|
704
|
+
</table>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
<div class="method_details ">
|
708
|
+
<h3 class="signature " id="scan_columns-instance_method">
|
709
|
+
|
710
|
+
#<strong>scan_columns</strong>(row:, columns:, matchers:) ⇒ <tt>Array</tt>
|
711
|
+
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
</h3><div class="docstring">
|
717
|
+
<div class="discussion">
|
718
|
+
<p class="note private">
|
719
|
+
<strong>This method is part of a private API.</strong>
|
720
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
721
|
+
</p>
|
722
|
+
|
723
|
+
<p>Scan all the specified <code>columns</code> (e.g., inputs) in the given
|
724
|
+
<code>data</code> row using the <code>matchers</code> array supplied.</p>
|
725
|
+
|
726
|
+
|
727
|
+
</div>
|
728
|
+
</div>
|
729
|
+
<div class="tags">
|
730
|
+
<p class="tag_title">Parameters:</p>
|
731
|
+
<ul class="param">
|
732
|
+
|
733
|
+
<li>
|
734
|
+
|
735
|
+
<span class='name'>row</span>
|
736
|
+
|
737
|
+
|
738
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
739
|
+
|
740
|
+
|
741
|
+
|
742
|
+
—
|
743
|
+
<div class='inline'>
|
744
|
+
<p>Data row - still just all string constants.</p>
|
745
|
+
</div>
|
746
|
+
|
747
|
+
</li>
|
748
|
+
|
749
|
+
<li>
|
750
|
+
|
751
|
+
<span class='name'>columns</span>
|
752
|
+
|
753
|
+
|
754
|
+
<span class='type'>(<tt>Array<Columns::Entry></tt>)</span>
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
—
|
759
|
+
<div class='inline'>
|
760
|
+
<p>Array of column dictionary entries.</p>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
</li>
|
764
|
+
|
765
|
+
<li>
|
766
|
+
|
767
|
+
<span class='name'>matchers</span>
|
768
|
+
|
769
|
+
|
770
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>></tt>)</span>
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
—
|
775
|
+
<div class='inline'>
|
776
|
+
<p>Array of table cell matchers.</p>
|
777
|
+
</div>
|
778
|
+
|
779
|
+
</li>
|
780
|
+
|
781
|
+
</ul>
|
782
|
+
|
783
|
+
<p class="tag_title">Returns:</p>
|
784
|
+
<ul class="return">
|
785
|
+
|
786
|
+
<li>
|
787
|
+
|
788
|
+
|
789
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
790
|
+
|
791
|
+
|
792
|
+
|
793
|
+
—
|
794
|
+
<div class='inline'>
|
795
|
+
<p>Data row with anything not a string constant replaced with a Proc or a
|
796
|
+
non-string constant.</p>
|
797
|
+
</div>
|
798
|
+
|
799
|
+
</li>
|
800
|
+
|
801
|
+
</ul>
|
802
|
+
|
803
|
+
</div><table class="source_code">
|
804
|
+
<tr>
|
805
|
+
<td>
|
806
|
+
<pre class="lines">
|
807
|
+
|
808
|
+
|
809
|
+
85
|
810
|
+
86
|
811
|
+
87
|
812
|
+
88
|
813
|
+
89
|
814
|
+
90
|
815
|
+
91
|
816
|
+
92
|
817
|
+
93
|
818
|
+
94
|
819
|
+
95
|
820
|
+
96
|
821
|
+
97
|
822
|
+
98
|
823
|
+
99
|
824
|
+
100
|
825
|
+
101
|
826
|
+
102</pre>
|
827
|
+
</td>
|
828
|
+
<td>
|
829
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/scan_row.rb', line 85</span>
|
830
|
+
|
831
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan_columns'>scan_columns</span><span class='lparen'>(</span><span class='label'>row:</span><span class='comma'>,</span> <span class='label'>columns:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='rparen'>)</span>
|
832
|
+
<span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</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>
|
833
|
+
<span class='id identifier rubyid_cell'>cell</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>
|
834
|
+
|
835
|
+
<span class='comment'># An empty input cell matches everything, and so never needs to be scanned,
|
836
|
+
</span> <span class='comment'># but it cannot be indexed either.
|
837
|
+
</span> <span class='kw'>next</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_indexed'>indexed</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_cell'>cell</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='op'>&&</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_ins?'>ins?</span>
|
838
|
+
|
839
|
+
<span class='comment'># If the column is text only then no special matchers need be used.
|
840
|
+
</span> <span class='kw'>next</span> <span class='ivar'>@constants</span> <span class='op'><<</span> <span class='id identifier rubyid_col'>col</span> <span class='kw'>if</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span> <span class='op'>==</span> <span class='kw'>false</span>
|
841
|
+
|
842
|
+
<span class='comment'># Need to scan the cell against all matchers, and possibly overwrite
|
843
|
+
</span> <span class='comment'># the cell contents with a Matchers::Proc value.
|
844
|
+
</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='op'>=</span> <span class='id identifier rubyid_scan_cell'>scan_cell</span><span class='lparen'>(</span><span class='label'>column:</span> <span class='id identifier rubyid_column'>column</span><span class='comma'>,</span> <span class='label'>col:</span> <span class='id identifier rubyid_col'>col</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'>cell:</span> <span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
|
845
|
+
<span class='kw'>end</span>
|
846
|
+
|
847
|
+
<span class='id identifier rubyid_row'>row</span>
|
848
|
+
<span class='kw'>end</span></pre>
|
849
|
+
</td>
|
850
|
+
</tr>
|
851
|
+
</table>
|
852
|
+
</div>
|
853
|
+
|
854
|
+
</div>
|
855
|
+
|
856
|
+
</div>
|
857
|
+
|
858
|
+
<div id="footer">
|
859
|
+
Generated on Sun Feb 11 10:26:08 2018 by
|
860
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
861
|
+
0.9.12 (ruby-2.4.0).
|
862
|
+
</div>
|
863
|
+
|
864
|
+
</div>
|
865
|
+
</body>
|
866
|
+
</html>
|