csv_decision 0.0.6 → 0.0.7
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 +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +112 -93
- data/benchmarks/rufus_decision.rb +9 -1
- data/csv_decision.gemspec +6 -6
- data/doc/CSVDecision.html +54 -90
- data/doc/CSVDecision/CellValidationError.html +1 -1
- data/doc/CSVDecision/Columns.html +104 -45
- data/doc/CSVDecision/Columns/Dictionary.html +40 -24
- data/doc/CSVDecision/Columns/Entry.html +209 -22
- data/doc/CSVDecision/Constant.html +9 -50
- data/doc/CSVDecision/Data.html +182 -47
- data/doc/CSVDecision/Decide.html +97 -93
- data/doc/CSVDecision/Decision.html +105 -294
- data/doc/CSVDecision/Error.html +1 -1
- data/doc/CSVDecision/FileError.html +1 -1
- data/doc/CSVDecision/Function.html +18 -7
- data/doc/CSVDecision/Guard.html +245 -0
- data/doc/CSVDecision/Header.html +58 -50
- data/doc/CSVDecision/Input.html +20 -12
- data/doc/CSVDecision/Load.html +80 -14
- data/doc/CSVDecision/Matchers.html +237 -279
- data/doc/CSVDecision/Matchers/Constant.html +280 -13
- data/doc/CSVDecision/Matchers/Function.html +188 -19
- data/doc/CSVDecision/Matchers/Guard.html +568 -0
- data/doc/CSVDecision/Matchers/Matcher.html +200 -14
- data/doc/CSVDecision/Matchers/Numeric.html +165 -13
- data/doc/CSVDecision/Matchers/Pattern.html +56 -163
- data/doc/CSVDecision/Matchers/Range.html +48 -37
- data/doc/CSVDecision/Matchers/Symbol.html +161 -16
- data/doc/CSVDecision/Numeric.html +4 -4
- data/doc/CSVDecision/Options.html +53 -55
- data/doc/CSVDecision/Parse.html +23 -13
- data/doc/CSVDecision/ScanRow.html +461 -73
- data/doc/CSVDecision/Symbol.html +4 -4
- data/doc/CSVDecision/Table.html +185 -79
- data/doc/_index.html +15 -28
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +105 -82
- data/doc/index.html +105 -82
- data/doc/method_list.html +137 -113
- data/doc/top-level-namespace.html +1 -1
- data/lib/csv_decision.rb +2 -5
- data/lib/csv_decision/columns.rb +14 -5
- data/lib/csv_decision/data.rb +24 -6
- data/lib/csv_decision/decide.rb +18 -20
- data/lib/csv_decision/decision.rb +106 -42
- data/lib/csv_decision/header.rb +44 -23
- data/lib/csv_decision/input.rb +4 -2
- data/lib/csv_decision/load.rb +7 -3
- data/lib/csv_decision/matchers.rb +49 -41
- data/lib/csv_decision/matchers/constant.rb +62 -4
- data/lib/csv_decision/matchers/function.rb +33 -2
- data/lib/csv_decision/matchers/guard.rb +143 -0
- data/lib/csv_decision/matchers/numeric.rb +34 -3
- data/lib/csv_decision/matchers/pattern.rb +11 -4
- data/lib/csv_decision/matchers/range.rb +34 -26
- data/lib/csv_decision/matchers/symbol.rb +71 -5
- data/lib/csv_decision/options.rb +31 -20
- data/lib/csv_decision/parse.rb +28 -9
- data/lib/csv_decision/scan_row.rb +79 -13
- data/lib/csv_decision/table.rb +34 -23
- data/spec/csv_decision/columns_spec.rb +32 -7
- data/spec/csv_decision/constant_spec.rb +2 -26
- data/spec/csv_decision/decision_spec.rb +0 -9
- data/spec/csv_decision/examples_spec.rb +33 -16
- data/spec/csv_decision/matchers/function_spec.rb +1 -1
- data/spec/csv_decision/matchers/guard_spec.rb +153 -0
- data/spec/csv_decision/matchers/numeric_spec.rb +1 -1
- data/spec/csv_decision/matchers/pattern_spec.rb +2 -2
- data/spec/csv_decision/matchers/range_spec.rb +2 -2
- data/spec/csv_decision/matchers/symbol_spec.rb +1 -1
- data/spec/csv_decision/options_spec.rb +3 -3
- data/spec/csv_decision/table_spec.rb +96 -12
- data/spec/data/valid/benchmark_regexp.csv +10 -0
- data/spec/data/valid/regular_expressions.csv +11 -0
- metadata +14 -9
- data/lib/csv_decision/constant.rb +0 -54
- data/lib/csv_decision/function.rb +0 -32
- data/lib/csv_decision/numeric.rb +0 -38
- data/lib/csv_decision/symbol.rb +0 -73
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<div id="content"><h1>Class: CSVDecision::Columns::Entry
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
<span class="private note title">Private</span>
|
|
66
66
|
</h1>
|
|
67
67
|
<div class="box_info">
|
|
68
68
|
|
|
@@ -103,7 +103,11 @@
|
|
|
103
103
|
|
|
104
104
|
<h2>Overview</h2><div class="docstring">
|
|
105
105
|
<div class="discussion">
|
|
106
|
-
|
|
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
|
+
|
|
107
111
|
<p>Value object to hold column dictionary entries.</p>
|
|
108
112
|
|
|
109
113
|
|
|
@@ -119,6 +123,33 @@
|
|
|
119
123
|
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
120
124
|
<ul class="summary">
|
|
121
125
|
|
|
126
|
+
<li class="public ">
|
|
127
|
+
<span class="summary_signature">
|
|
128
|
+
|
|
129
|
+
<a href="#eval-instance_method" title="#eval (instance method)">#<strong>eval</strong> ⇒ Object </a>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
</span>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<span class="summary_desc"><div class='inline'>
|
|
147
|
+
<p>Returns the value of attribute eval.</p>
|
|
148
|
+
</div></span>
|
|
149
|
+
|
|
150
|
+
</li>
|
|
151
|
+
|
|
152
|
+
|
|
122
153
|
<li class="public ">
|
|
123
154
|
<span class="summary_signature">
|
|
124
155
|
|
|
@@ -149,7 +180,7 @@
|
|
|
149
180
|
<li class="public ">
|
|
150
181
|
<span class="summary_signature">
|
|
151
182
|
|
|
152
|
-
<a href="#
|
|
183
|
+
<a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> ⇒ Object </a>
|
|
153
184
|
|
|
154
185
|
|
|
155
186
|
|
|
@@ -167,7 +198,7 @@
|
|
|
167
198
|
|
|
168
199
|
|
|
169
200
|
<span class="summary_desc"><div class='inline'>
|
|
170
|
-
<p>Returns the value of attribute
|
|
201
|
+
<p>Returns the value of attribute type.</p>
|
|
171
202
|
</div></span>
|
|
172
203
|
|
|
173
204
|
</li>
|
|
@@ -178,15 +209,109 @@
|
|
|
178
209
|
|
|
179
210
|
|
|
180
211
|
|
|
212
|
+
|
|
213
|
+
<h2>
|
|
214
|
+
Instance Method Summary
|
|
215
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
216
|
+
</h2>
|
|
217
|
+
|
|
218
|
+
<ul class="summary">
|
|
219
|
+
|
|
220
|
+
<li class="public ">
|
|
221
|
+
<span class="summary_signature">
|
|
222
|
+
|
|
223
|
+
<a href="#ins%3F-instance_method" title="#ins? (instance method)">#<strong>ins?</strong> ⇒ Boolean </a>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
</span>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
<span class="private note title">private</span>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
238
|
+
|
|
239
|
+
</li>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
</ul>
|
|
243
|
+
|
|
244
|
+
|
|
181
245
|
|
|
182
246
|
|
|
183
247
|
<div id="instance_attr_details" class="attr_details">
|
|
184
248
|
<h2>Instance Attribute Details</h2>
|
|
185
249
|
|
|
186
250
|
|
|
187
|
-
<span id="
|
|
251
|
+
<span id="eval=-instance_method"></span>
|
|
188
252
|
<div class="method_details first">
|
|
189
|
-
<h3 class="signature first" id="
|
|
253
|
+
<h3 class="signature first" id="eval-instance_method">
|
|
254
|
+
|
|
255
|
+
#<strong>eval</strong> ⇒ <tt>Object</tt>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
</h3><div class="docstring">
|
|
262
|
+
<div class="discussion">
|
|
263
|
+
|
|
264
|
+
<p>Returns the value of attribute eval</p>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
<div class="tags">
|
|
270
|
+
|
|
271
|
+
<p class="tag_title">Returns:</p>
|
|
272
|
+
<ul class="return">
|
|
273
|
+
|
|
274
|
+
<li>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
—
|
|
282
|
+
<div class='inline'>
|
|
283
|
+
<p>the current value of eval</p>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
</li>
|
|
287
|
+
|
|
288
|
+
</ul>
|
|
289
|
+
|
|
290
|
+
</div><table class="source_code">
|
|
291
|
+
<tr>
|
|
292
|
+
<td>
|
|
293
|
+
<pre class="lines">
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
12
|
|
297
|
+
13
|
|
298
|
+
14</pre>
|
|
299
|
+
</td>
|
|
300
|
+
<td>
|
|
301
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 12</span>
|
|
302
|
+
|
|
303
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_eval'>eval</span>
|
|
304
|
+
<span class='ivar'>@eval</span>
|
|
305
|
+
<span class='kw'>end</span></pre>
|
|
306
|
+
</td>
|
|
307
|
+
</tr>
|
|
308
|
+
</table>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<span id="name=-instance_method"></span>
|
|
313
|
+
<div class="method_details ">
|
|
314
|
+
<h3 class="signature " id="name-instance_method">
|
|
190
315
|
|
|
191
316
|
#<strong>name</strong> ⇒ <tt>Object</tt>
|
|
192
317
|
|
|
@@ -229,12 +354,12 @@
|
|
|
229
354
|
<pre class="lines">
|
|
230
355
|
|
|
231
356
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
357
|
+
12
|
|
358
|
+
13
|
|
359
|
+
14</pre>
|
|
235
360
|
</td>
|
|
236
361
|
<td>
|
|
237
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line
|
|
362
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 12</span>
|
|
238
363
|
|
|
239
364
|
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
|
240
365
|
<span class='ivar'>@name</span>
|
|
@@ -245,11 +370,11 @@
|
|
|
245
370
|
</div>
|
|
246
371
|
|
|
247
372
|
|
|
248
|
-
<span id="
|
|
373
|
+
<span id="type=-instance_method"></span>
|
|
249
374
|
<div class="method_details ">
|
|
250
|
-
<h3 class="signature " id="
|
|
375
|
+
<h3 class="signature " id="type-instance_method">
|
|
251
376
|
|
|
252
|
-
#<strong>
|
|
377
|
+
#<strong>type</strong> ⇒ <tt>Object</tt>
|
|
253
378
|
|
|
254
379
|
|
|
255
380
|
|
|
@@ -258,7 +383,7 @@
|
|
|
258
383
|
</h3><div class="docstring">
|
|
259
384
|
<div class="discussion">
|
|
260
385
|
|
|
261
|
-
<p>Returns the value of attribute
|
|
386
|
+
<p>Returns the value of attribute type</p>
|
|
262
387
|
|
|
263
388
|
|
|
264
389
|
</div>
|
|
@@ -277,7 +402,7 @@
|
|
|
277
402
|
|
|
278
403
|
—
|
|
279
404
|
<div class='inline'>
|
|
280
|
-
<p>the current value of
|
|
405
|
+
<p>the current value of type</p>
|
|
281
406
|
</div>
|
|
282
407
|
|
|
283
408
|
</li>
|
|
@@ -290,15 +415,15 @@
|
|
|
290
415
|
<pre class="lines">
|
|
291
416
|
|
|
292
417
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
418
|
+
12
|
|
419
|
+
13
|
|
420
|
+
14</pre>
|
|
296
421
|
</td>
|
|
297
422
|
<td>
|
|
298
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line
|
|
423
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 12</span>
|
|
299
424
|
|
|
300
|
-
<span class='kw'>def</span> <span class='id identifier
|
|
301
|
-
<span class='ivar'>@
|
|
425
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
|
426
|
+
<span class='ivar'>@type</span>
|
|
302
427
|
<span class='kw'>end</span></pre>
|
|
303
428
|
</td>
|
|
304
429
|
</tr>
|
|
@@ -308,10 +433,72 @@
|
|
|
308
433
|
</div>
|
|
309
434
|
|
|
310
435
|
|
|
436
|
+
<div id="instance_method_details" class="method_details_list">
|
|
437
|
+
<h2>Instance Method Details</h2>
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
<div class="method_details first">
|
|
441
|
+
<h3 class="signature first" id="ins?-instance_method">
|
|
442
|
+
|
|
443
|
+
#<strong>ins?</strong> ⇒ <tt>Boolean</tt>
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
</h3><div class="docstring">
|
|
450
|
+
<div class="discussion">
|
|
451
|
+
<p class="note private">
|
|
452
|
+
<strong>This method is part of a private API.</strong>
|
|
453
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
454
|
+
</p>
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
<div class="tags">
|
|
460
|
+
|
|
461
|
+
<p class="tag_title">Returns:</p>
|
|
462
|
+
<ul class="return">
|
|
463
|
+
|
|
464
|
+
<li>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
</li>
|
|
472
|
+
|
|
473
|
+
</ul>
|
|
474
|
+
|
|
475
|
+
</div><table class="source_code">
|
|
476
|
+
<tr>
|
|
477
|
+
<td>
|
|
478
|
+
<pre class="lines">
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
13
|
|
482
|
+
14
|
|
483
|
+
15</pre>
|
|
484
|
+
</td>
|
|
485
|
+
<td>
|
|
486
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/columns.rb', line 13</span>
|
|
487
|
+
|
|
488
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ins?'>ins?</span>
|
|
489
|
+
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>in</span><span class='words_sep'> </span><span class='tstring_content'>guard</span><span class='words_sep'>]</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
|
490
|
+
<span class='kw'>end</span></pre>
|
|
491
|
+
</td>
|
|
492
|
+
</tr>
|
|
493
|
+
</table>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
</div>
|
|
497
|
+
|
|
311
498
|
</div>
|
|
312
499
|
|
|
313
500
|
<div id="footer">
|
|
314
|
-
Generated on
|
|
501
|
+
Generated on Sat Dec 30 13:04:05 2017 by
|
|
315
502
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
316
503
|
0.9.12 (ruby-2.3.0).
|
|
317
504
|
</div>
|
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
<h2>Overview</h2><div class="docstring">
|
|
87
87
|
<div class="discussion">
|
|
88
88
|
|
|
89
|
-
<p>Recognise constant expressions in table data cells
|
|
89
|
+
<p>Recognise constant expressions in table data cells - e.g., <tt>= nil</tt>,
|
|
90
|
+
<tt>:=true</tt>.</p>
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
</div>
|
|
@@ -95,48 +96,6 @@
|
|
|
95
96
|
|
|
96
97
|
|
|
97
98
|
</div>
|
|
98
|
-
<h2>Constant Summary</h2>
|
|
99
|
-
<dl class="constants">
|
|
100
|
-
|
|
101
|
-
<dt id="EXPRESSION-constant" class="">EXPRESSION =
|
|
102
|
-
<div class="docstring">
|
|
103
|
-
<div class="discussion">
|
|
104
|
-
|
|
105
|
-
<p>Cell constant expression specified by prefixing the value with one of the
|
|
106
|
-
three equality symbols.</p>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
<div class="tags">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</div>
|
|
115
|
-
</dt>
|
|
116
|
-
<dd><pre class="code"><span class='const'><span class='object_link'><a href="Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='period'>.</span><span class='id identifier rubyid_regexp'><span class='object_link'><a href="Matchers.html#regexp-class_method" title="CSVDecision::Matchers.regexp (method)">regexp</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(?<operator></span><span class='embexpr_beg'>#{</span><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="Matchers.html#EQUALS-constant" title="CSVDecision::Matchers::EQUALS (constant)">EQUALS</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>)\\s*(?<value>\\S.*)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span></pre></dd>
|
|
117
|
-
|
|
118
|
-
<dt id="NON_NUMERIC-constant" class="">NON_NUMERIC =
|
|
119
|
-
<div class="docstring">
|
|
120
|
-
<div class="discussion">
|
|
121
|
-
|
|
122
|
-
<p>Non-numeric constants recognised by CSV Decision.</p>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
<div class="tags">
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</div>
|
|
131
|
-
</dt>
|
|
132
|
-
<dd><pre class="code"><span class='lbrace'>{</span>
|
|
133
|
-
<span class='label'>nil:</span> <span class='kw'>nil</span><span class='comma'>,</span>
|
|
134
|
-
<span class='label'>true:</span> <span class='kw'>true</span><span class='comma'>,</span>
|
|
135
|
-
<span class='label'>false:</span> <span class='kw'>false</span>
|
|
136
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
|
137
|
-
|
|
138
|
-
</dl>
|
|
139
|
-
|
|
140
99
|
|
|
141
100
|
|
|
142
101
|
|
|
@@ -255,20 +214,20 @@ some type of function.</p>
|
|
|
255
214
|
<pre class="lines">
|
|
256
215
|
|
|
257
216
|
|
|
258
|
-
24
|
|
259
|
-
25
|
|
260
|
-
26
|
|
261
217
|
27
|
|
262
218
|
28
|
|
263
219
|
29
|
|
264
220
|
30
|
|
265
|
-
31
|
|
221
|
+
31
|
|
222
|
+
32
|
|
223
|
+
33
|
|
224
|
+
34</pre>
|
|
266
225
|
</td>
|
|
267
226
|
<td>
|
|
268
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/constant.rb', line
|
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/constant.rb', line 27</span>
|
|
269
228
|
|
|
270
229
|
<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>
|
|
271
|
-
<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'
|
|
230
|
+
<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>
|
|
272
231
|
|
|
273
232
|
<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>
|
|
274
233
|
<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>
|
|
@@ -285,7 +244,7 @@ some type of function.</p>
|
|
|
285
244
|
</div>
|
|
286
245
|
|
|
287
246
|
<div id="footer">
|
|
288
|
-
Generated on
|
|
247
|
+
Generated on Fri Dec 29 09:33:35 2017 by
|
|
289
248
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
290
249
|
0.9.12 (ruby-2.3.0).
|
|
291
250
|
</div>
|
data/doc/CSVDecision/Data.html
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<div id="content"><h1>Module: CSVDecision::Data
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
<span class="private note title">Private</span>
|
|
66
66
|
</h1>
|
|
67
67
|
<div class="box_info">
|
|
68
68
|
|
|
@@ -85,8 +85,12 @@
|
|
|
85
85
|
|
|
86
86
|
<h2>Overview</h2><div class="docstring">
|
|
87
87
|
<div class="discussion">
|
|
88
|
-
|
|
89
|
-
<
|
|
88
|
+
<p class="note private">
|
|
89
|
+
<strong>This module is part of a private API.</strong>
|
|
90
|
+
You should avoid using this module if possible, as it may be removed or be changed in the future.
|
|
91
|
+
</p>
|
|
92
|
+
|
|
93
|
+
<p>Methods to load data from a file, CSV string or an array of arrays.</p>
|
|
90
94
|
|
|
91
95
|
|
|
92
96
|
</div>
|
|
@@ -95,16 +99,6 @@
|
|
|
95
99
|
|
|
96
100
|
|
|
97
101
|
</div>
|
|
98
|
-
<h2>Constant Summary</h2>
|
|
99
|
-
<dl class="constants">
|
|
100
|
-
|
|
101
|
-
<dt id="CSV_OPTIONS-constant" class="">CSV_OPTIONS =
|
|
102
|
-
|
|
103
|
-
</dt>
|
|
104
|
-
<dd><pre class="code"><span class='lbrace'>{</span> <span class='label'>encoding:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>skip_blanks:</span> <span class='kw'>true</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
|
105
|
-
|
|
106
|
-
</dl>
|
|
107
|
-
|
|
108
102
|
|
|
109
103
|
|
|
110
104
|
|
|
@@ -122,7 +116,7 @@
|
|
|
122
116
|
<li class="public ">
|
|
123
117
|
<span class="summary_signature">
|
|
124
118
|
|
|
125
|
-
<a href="#input_file%3F-class_method" title="input_file? (class method)">.<strong>input_file?</strong>(
|
|
119
|
+
<a href="#input_file%3F-class_method" title="input_file? (class method)">.<strong>input_file?</strong>(data) ⇒ Boolean </a>
|
|
126
120
|
|
|
127
121
|
|
|
128
122
|
|
|
@@ -133,10 +127,12 @@
|
|
|
133
127
|
|
|
134
128
|
|
|
135
129
|
|
|
136
|
-
|
|
130
|
+
<span class="private note title">private</span>
|
|
137
131
|
|
|
138
132
|
|
|
139
|
-
<span class="summary_desc"><div class='inline'
|
|
133
|
+
<span class="summary_desc"><div class='inline'>
|
|
134
|
+
<p>If the input is a file name return true, otherwise false.</p>
|
|
135
|
+
</div></span>
|
|
140
136
|
|
|
141
137
|
</li>
|
|
142
138
|
|
|
@@ -144,7 +140,7 @@
|
|
|
144
140
|
<li class="public ">
|
|
145
141
|
<span class="summary_signature">
|
|
146
142
|
|
|
147
|
-
<a href="#strip_columns-class_method" title="strip_columns (class method)">.<strong>strip_columns</strong>(data:, empty_columns:) ⇒
|
|
143
|
+
<a href="#strip_columns-class_method" title="strip_columns (class method)">.<strong>strip_columns</strong>(data:, empty_columns:) ⇒ Array<Array<String>> </a>
|
|
148
144
|
|
|
149
145
|
|
|
150
146
|
|
|
@@ -155,10 +151,12 @@
|
|
|
155
151
|
|
|
156
152
|
|
|
157
153
|
|
|
158
|
-
|
|
154
|
+
<span class="private note title">private</span>
|
|
159
155
|
|
|
160
156
|
|
|
161
|
-
<span class="summary_desc"><div class='inline'
|
|
157
|
+
<span class="summary_desc"><div class='inline'>
|
|
158
|
+
<p>Strip the empty columns from the input data rows.</p>
|
|
159
|
+
</div></span>
|
|
162
160
|
|
|
163
161
|
</li>
|
|
164
162
|
|
|
@@ -166,7 +164,7 @@
|
|
|
166
164
|
<li class="public ">
|
|
167
165
|
<span class="summary_signature">
|
|
168
166
|
|
|
169
|
-
<a href="#to_array-class_method" title="to_array (class method)">.<strong>to_array</strong>(data:) ⇒
|
|
167
|
+
<a href="#to_array-class_method" title="to_array (class method)">.<strong>to_array</strong>(data:) ⇒ Array<Array<String>> </a>
|
|
170
168
|
|
|
171
169
|
|
|
172
170
|
|
|
@@ -177,7 +175,7 @@
|
|
|
177
175
|
|
|
178
176
|
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+
<span class="private note title">private</span>
|
|
181
179
|
|
|
182
180
|
|
|
183
181
|
<span class="summary_desc"><div class='inline'>
|
|
@@ -200,7 +198,7 @@ array of arrays.</p>
|
|
|
200
198
|
<div class="method_details first">
|
|
201
199
|
<h3 class="signature first" id="input_file?-class_method">
|
|
202
200
|
|
|
203
|
-
.<strong>input_file?</strong>(
|
|
201
|
+
.<strong>input_file?</strong>(data) ⇒ <tt>Boolean</tt>
|
|
204
202
|
|
|
205
203
|
|
|
206
204
|
|
|
@@ -208,12 +206,38 @@ array of arrays.</p>
|
|
|
208
206
|
|
|
209
207
|
</h3><div class="docstring">
|
|
210
208
|
<div class="discussion">
|
|
211
|
-
|
|
209
|
+
<p class="note private">
|
|
210
|
+
<strong>This method is part of a private API.</strong>
|
|
211
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
212
|
+
</p>
|
|
213
|
+
|
|
214
|
+
<p>If the input is a file name return true, otherwise false.</p>
|
|
215
|
+
|
|
212
216
|
|
|
213
217
|
</div>
|
|
214
218
|
</div>
|
|
215
219
|
<div class="tags">
|
|
220
|
+
<p class="tag_title">Parameters:</p>
|
|
221
|
+
<ul class="param">
|
|
222
|
+
|
|
223
|
+
<li>
|
|
224
|
+
|
|
225
|
+
<span class='name'>data</span>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>, <tt>String</tt>)</span>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
—
|
|
233
|
+
<div class='inline'>
|
|
234
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
</li>
|
|
216
238
|
|
|
239
|
+
</ul>
|
|
240
|
+
|
|
217
241
|
<p class="tag_title">Returns:</p>
|
|
218
242
|
<ul class="return">
|
|
219
243
|
|
|
@@ -224,6 +248,11 @@ array of arrays.</p>
|
|
|
224
248
|
|
|
225
249
|
|
|
226
250
|
|
|
251
|
+
—
|
|
252
|
+
<div class='inline'>
|
|
253
|
+
<p>Set to true if the input data is passed as a File or Pathname.</p>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
227
256
|
</li>
|
|
228
257
|
|
|
229
258
|
</ul>
|
|
@@ -234,15 +263,15 @@ array of arrays.</p>
|
|
|
234
263
|
<pre class="lines">
|
|
235
264
|
|
|
236
265
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
266
|
+
34
|
|
267
|
+
35
|
|
268
|
+
36</pre>
|
|
240
269
|
</td>
|
|
241
270
|
<td>
|
|
242
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line
|
|
271
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 34</span>
|
|
243
272
|
|
|
244
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_input_file?'>input_file?</span><span class='lparen'>(</span><span class='id identifier
|
|
245
|
-
<span class='id identifier
|
|
273
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_input_file?'>input_file?</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
|
274
|
+
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Pathname</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>File</span><span class='rparen'>)</span>
|
|
246
275
|
<span class='kw'>end</span></pre>
|
|
247
276
|
</td>
|
|
248
277
|
</tr>
|
|
@@ -252,28 +281,92 @@ array of arrays.</p>
|
|
|
252
281
|
<div class="method_details ">
|
|
253
282
|
<h3 class="signature " id="strip_columns-class_method">
|
|
254
283
|
|
|
255
|
-
.<strong>strip_columns</strong>(data:, empty_columns:) ⇒ <tt>
|
|
284
|
+
.<strong>strip_columns</strong>(data:, empty_columns:) ⇒ <tt>Array<Array<String>></tt>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
256
289
|
|
|
290
|
+
</h3><div class="docstring">
|
|
291
|
+
<div class="discussion">
|
|
292
|
+
<p class="note private">
|
|
293
|
+
<strong>This method is part of a private API.</strong>
|
|
294
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
295
|
+
</p>
|
|
296
|
+
|
|
297
|
+
<p>Strip the empty columns from the input data rows.</p>
|
|
257
298
|
|
|
299
|
+
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div class="tags">
|
|
303
|
+
<p class="tag_title">Parameters:</p>
|
|
304
|
+
<ul class="param">
|
|
305
|
+
|
|
306
|
+
<li>
|
|
307
|
+
|
|
308
|
+
<span class='name'>empty_columns</span>
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
<span class='type'>(<tt>Array<Index></tt>)</span>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
</li>
|
|
316
|
+
|
|
317
|
+
<li>
|
|
318
|
+
|
|
319
|
+
<span class='name'>data</span>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>, <tt>String</tt>)</span>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
—
|
|
327
|
+
<div class='inline'>
|
|
328
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
</li>
|
|
258
332
|
|
|
333
|
+
</ul>
|
|
259
334
|
|
|
335
|
+
<p class="tag_title">Returns:</p>
|
|
336
|
+
<ul class="return">
|
|
337
|
+
|
|
338
|
+
<li>
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
—
|
|
346
|
+
<div class='inline'>
|
|
347
|
+
<p>Data array stripped of empty columns.</p>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
</li>
|
|
260
351
|
|
|
261
|
-
</
|
|
352
|
+
</ul>
|
|
353
|
+
|
|
354
|
+
</div><table class="source_code">
|
|
262
355
|
<tr>
|
|
263
356
|
<td>
|
|
264
357
|
<pre class="lines">
|
|
265
358
|
|
|
266
359
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
360
|
+
43
|
|
361
|
+
44
|
|
362
|
+
45
|
|
363
|
+
46
|
|
364
|
+
47
|
|
365
|
+
48
|
|
366
|
+
49</pre>
|
|
274
367
|
</td>
|
|
275
368
|
<td>
|
|
276
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line
|
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 43</span>
|
|
277
370
|
|
|
278
371
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_strip_columns'>strip_columns</span><span class='lparen'>(</span><span class='label'>data:</span><span class='comma'>,</span> <span class='label'>empty_columns:</span><span class='rparen'>)</span>
|
|
279
372
|
<span class='comment'># Adjust column indices as we delete columns the rest shift to the left by 1
|
|
@@ -290,7 +383,7 @@ array of arrays.</p>
|
|
|
290
383
|
<div class="method_details ">
|
|
291
384
|
<h3 class="signature " id="to_array-class_method">
|
|
292
385
|
|
|
293
|
-
.<strong>to_array</strong>(data:) ⇒ <tt>
|
|
386
|
+
.<strong>to_array</strong>(data:) ⇒ <tt>Array<Array<String>></tt>
|
|
294
387
|
|
|
295
388
|
|
|
296
389
|
|
|
@@ -298,15 +391,57 @@ array of arrays.</p>
|
|
|
298
391
|
|
|
299
392
|
</h3><div class="docstring">
|
|
300
393
|
<div class="discussion">
|
|
301
|
-
|
|
394
|
+
<p class="note private">
|
|
395
|
+
<strong>This method is part of a private API.</strong>
|
|
396
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
397
|
+
</p>
|
|
398
|
+
|
|
302
399
|
<p>Parse the input data which may either be a file path name, CSV string or
|
|
303
|
-
array of arrays. Strips out empty columns/rows and comment cells
|
|
400
|
+
array of arrays. Strips out empty columns/rows and comment cells.</p>
|
|
304
401
|
|
|
305
402
|
|
|
306
403
|
</div>
|
|
307
404
|
</div>
|
|
308
405
|
<div class="tags">
|
|
406
|
+
<p class="tag_title">Parameters:</p>
|
|
407
|
+
<ul class="param">
|
|
408
|
+
|
|
409
|
+
<li>
|
|
410
|
+
|
|
411
|
+
<span class='name'>data</span>
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>, <tt>String</tt>)</span>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
—
|
|
419
|
+
<div class='inline'>
|
|
420
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
</li>
|
|
424
|
+
|
|
425
|
+
</ul>
|
|
426
|
+
|
|
427
|
+
<p class="tag_title">Returns:</p>
|
|
428
|
+
<ul class="return">
|
|
429
|
+
|
|
430
|
+
<li>
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
—
|
|
438
|
+
<div class='inline'>
|
|
439
|
+
<p>Data array stripped of empty rows.</p>
|
|
440
|
+
</div>
|
|
441
|
+
|
|
442
|
+
</li>
|
|
309
443
|
|
|
444
|
+
</ul>
|
|
310
445
|
|
|
311
446
|
</div><table class="source_code">
|
|
312
447
|
<tr>
|
|
@@ -314,12 +449,12 @@ array of arrays. Strips out empty columns/rows and comment cells</p>
|
|
|
314
449
|
<pre class="lines">
|
|
315
450
|
|
|
316
451
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
452
|
+
26
|
|
453
|
+
27
|
|
454
|
+
28</pre>
|
|
320
455
|
</td>
|
|
321
456
|
<td>
|
|
322
|
-
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line
|
|
457
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 26</span>
|
|
323
458
|
|
|
324
459
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_array'>to_array</span><span class='lparen'>(</span><span class='label'>data:</span><span class='rparen'>)</span>
|
|
325
460
|
<span class='id identifier rubyid_strip_rows'>strip_rows</span><span class='lparen'>(</span><span class='label'>data:</span> <span class='id identifier rubyid_data_array'>data_array</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
@@ -334,7 +469,7 @@ array of arrays. Strips out empty columns/rows and comment cells</p>
|
|
|
334
469
|
</div>
|
|
335
470
|
|
|
336
471
|
<div id="footer">
|
|
337
|
-
Generated on
|
|
472
|
+
Generated on Sat Dec 30 13:04:04 2017 by
|
|
338
473
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
339
474
|
0.9.12 (ruby-2.3.0).
|
|
340
475
|
</div>
|