csv_decision 0.0.3 → 0.0.4
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/.codeclimate.yml +2 -0
- data/.gitignore +2 -1
- data/.travis.yml +2 -3
- data/CHANGELOG.md +19 -1
- data/README.md +49 -16
- data/{benchmark.rb → benchmarks/rufus_decision.rb} +1 -1
- data/csv_decision.gemspec +1 -1
- data/doc/CSVDecision/CellValidationError.html +143 -0
- data/doc/CSVDecision/Columns/Default.html +409 -0
- data/doc/CSVDecision/Columns/Dictionary.html +410 -0
- data/doc/CSVDecision/Columns/Entry.html +321 -0
- data/doc/CSVDecision/Columns.html +476 -0
- data/doc/CSVDecision/Constant.html +295 -0
- data/doc/CSVDecision/Data.html +344 -0
- data/doc/CSVDecision/Decide.html +434 -0
- data/doc/CSVDecision/Decision.html +604 -0
- data/doc/CSVDecision/Error.html +139 -0
- data/doc/CSVDecision/FileError.html +143 -0
- data/doc/CSVDecision/Function.html +229 -0
- data/doc/CSVDecision/Header.html +520 -0
- data/doc/CSVDecision/Input.html +305 -0
- data/doc/CSVDecision/Load.html +225 -0
- data/doc/CSVDecision/Matchers/Constant.html +242 -0
- data/doc/CSVDecision/Matchers/Function.html +342 -0
- data/doc/CSVDecision/Matchers/Matcher.html +325 -0
- data/doc/CSVDecision/Matchers/Numeric.html +277 -0
- data/doc/CSVDecision/Matchers/Pattern.html +600 -0
- data/doc/CSVDecision/Matchers/Range.html +413 -0
- data/doc/CSVDecision/Matchers/Symbol.html +280 -0
- data/doc/CSVDecision/Matchers.html +1529 -0
- data/doc/CSVDecision/Numeric.html +259 -0
- data/doc/CSVDecision/Options.html +445 -0
- data/doc/CSVDecision/Parse.html +270 -0
- data/doc/CSVDecision/ScanRow.html +746 -0
- data/doc/CSVDecision/Symbol.html +256 -0
- data/doc/CSVDecision/Table.html +1115 -0
- data/doc/CSVDecision.html +652 -0
- data/doc/_index.html +410 -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 +264 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +264 -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 +683 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/csv_decision/columns.rb +15 -12
- data/lib/csv_decision/constant.rb +54 -0
- data/lib/csv_decision/decide.rb +5 -5
- data/lib/csv_decision/decision.rb +3 -1
- data/lib/csv_decision/function.rb +32 -0
- data/lib/csv_decision/header.rb +27 -18
- data/lib/csv_decision/input.rb +11 -8
- data/lib/csv_decision/matchers/constant.rb +18 -0
- data/lib/csv_decision/matchers/function.rb +11 -44
- data/lib/csv_decision/matchers/numeric.rb +5 -33
- data/lib/csv_decision/matchers/pattern.rb +26 -11
- data/lib/csv_decision/matchers/range.rb +21 -5
- data/lib/csv_decision/matchers/symbol.rb +20 -0
- data/lib/csv_decision/matchers.rb +85 -20
- data/lib/csv_decision/numeric.rb +38 -0
- data/lib/csv_decision/options.rb +36 -27
- data/lib/csv_decision/parse.rb +46 -39
- data/lib/csv_decision/scan_row.rb +19 -7
- data/lib/csv_decision/symbol.rb +73 -0
- data/lib/csv_decision/table.rb +24 -18
- data/lib/csv_decision.rb +25 -18
- data/spec/csv_decision/columns_spec.rb +1 -1
- data/spec/csv_decision/constant_spec.rb +60 -0
- data/spec/csv_decision/examples_spec.rb +119 -0
- data/spec/csv_decision/matchers/function_spec.rb +48 -28
- data/spec/csv_decision/matchers/numeric_spec.rb +4 -41
- data/spec/csv_decision/matchers/range_spec.rb +31 -61
- data/spec/csv_decision/matchers/symbol_spec.rb +65 -0
- data/spec/csv_decision/options_spec.rb +14 -2
- data/spec/csv_decision/parse_spec.rb +10 -0
- data/spec/csv_decision/table_spec.rb +112 -6
- data/spec/data/valid/simple_constants.csv +3 -3
- metadata +62 -7
- data/spec/csv_decision/simple_example_spec.rb +0 -75
- /data/spec/{csv_decision.rb → csv_decision_spec.rb} +0 -0
|
@@ -0,0 +1,604 @@
|
|
|
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::Decision
|
|
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::Decision";
|
|
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 (D)</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">Decision</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::Decision
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
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::Decision</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/decision.rb</dd>
|
|
98
|
+
</dl>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
<p>Accumulate the matching row(s) and calculate the final result</p>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="tags">
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<h2>
|
|
122
|
+
Instance Method Summary
|
|
123
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
124
|
+
</h2>
|
|
125
|
+
|
|
126
|
+
<ul class="summary">
|
|
127
|
+
|
|
128
|
+
<li class="public ">
|
|
129
|
+
<span class="summary_signature">
|
|
130
|
+
|
|
131
|
+
<a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(row) ⇒ Object </a>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
</span>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
146
|
+
|
|
147
|
+
</li>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<li class="public ">
|
|
151
|
+
<span class="summary_signature">
|
|
152
|
+
|
|
153
|
+
<a href="#empty%3F-instance_method" title="#empty? (instance method)">#<strong>empty?</strong> ⇒ Boolean </a>
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
</span>
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
<span class="summary_desc"><div class='inline'>
|
|
168
|
+
<p>Is the result set empty? That is, nothing matched?.</p>
|
|
169
|
+
</div></span>
|
|
170
|
+
|
|
171
|
+
</li>
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<li class="public ">
|
|
175
|
+
<span class="summary_signature">
|
|
176
|
+
|
|
177
|
+
<a href="#exist%3F-instance_method" title="#exist? (instance method)">#<strong>exist?</strong> ⇒ Boolean </a>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
</span>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
192
|
+
|
|
193
|
+
</li>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
<li class="public ">
|
|
197
|
+
<span class="summary_signature">
|
|
198
|
+
|
|
199
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(table:, input:) ⇒ Decision </a>
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
</span>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<span class="note title constructor">constructor</span>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
|
216
|
+
<p>A new instance of Decision.</p>
|
|
217
|
+
</div></span>
|
|
218
|
+
|
|
219
|
+
</li>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<li class="public ">
|
|
223
|
+
<span class="summary_signature">
|
|
224
|
+
|
|
225
|
+
<a href="#result-instance_method" title="#result (instance method)">#<strong>result</strong> ⇒ Object </a>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
</span>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
240
|
+
|
|
241
|
+
</li>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
<li class="public ">
|
|
245
|
+
<span class="summary_signature">
|
|
246
|
+
|
|
247
|
+
<a href="#scan-instance_method" title="#scan (instance method)">#<strong>scan</strong>(table:, input:) ⇒ Object </a>
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
</span>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
262
|
+
|
|
263
|
+
</li>
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
</ul>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<div id="constructor_details" class="method_details_list">
|
|
270
|
+
<h2>Constructor Details</h2>
|
|
271
|
+
|
|
272
|
+
<div class="method_details first">
|
|
273
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
274
|
+
|
|
275
|
+
#<strong>initialize</strong>(table:, input:) ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::Decision (class)">Decision</a></span></tt>
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
</h3><div class="docstring">
|
|
282
|
+
<div class="discussion">
|
|
283
|
+
|
|
284
|
+
<p>Returns a new instance of Decision</p>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
<div class="tags">
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
</div><table class="source_code">
|
|
293
|
+
<tr>
|
|
294
|
+
<td>
|
|
295
|
+
<pre class="lines">
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
9
|
|
299
|
+
10
|
|
300
|
+
11
|
|
301
|
+
12
|
|
302
|
+
13
|
|
303
|
+
14
|
|
304
|
+
15
|
|
305
|
+
16
|
|
306
|
+
17
|
|
307
|
+
18
|
|
308
|
+
19
|
|
309
|
+
20
|
|
310
|
+
21
|
|
311
|
+
22
|
|
312
|
+
23
|
|
313
|
+
24
|
|
314
|
+
25
|
|
315
|
+
26
|
|
316
|
+
27
|
|
317
|
+
28</pre>
|
|
318
|
+
</td>
|
|
319
|
+
<td>
|
|
320
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 9</span>
|
|
321
|
+
|
|
322
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='rparen'>)</span>
|
|
323
|
+
<span class='ivar'>@result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
324
|
+
|
|
325
|
+
<span class='comment'># Relevant table attributes
|
|
326
|
+
</span> <span class='ivar'>@first_match</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:first_match</span><span class='rbracket'>]</span>
|
|
327
|
+
<span class='ivar'>@outs</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_outs'>outs</span>
|
|
328
|
+
|
|
329
|
+
<span class='comment'># TODO: Planned feature
|
|
330
|
+
</span> <span class='comment'># @outs_functions = table.outs_functions
|
|
331
|
+
</span>
|
|
332
|
+
<span class='comment'># Partial result always includes the input hash for calculating output functions
|
|
333
|
+
</span> <span class='ivar'>@partial_result</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='lbracket'>[</span><span class='symbol'>:hash</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='kw'>if</span> <span class='ivar'>@outs_functions</span>
|
|
334
|
+
|
|
335
|
+
<span class='ivar'>@row_picked</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
336
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='ivar'>@first_match</span>
|
|
337
|
+
|
|
338
|
+
<span class='comment'># Extra attributes for the accumulate option
|
|
339
|
+
</span> <span class='ivar'>@rows_picked</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
340
|
+
<span class='ivar'>@multi_result</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
341
|
+
<span class='kw'>end</span></pre>
|
|
342
|
+
</td>
|
|
343
|
+
</tr>
|
|
344
|
+
</table>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
<div id="instance_method_details" class="method_details_list">
|
|
351
|
+
<h2>Instance Method Details</h2>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
<div class="method_details first">
|
|
355
|
+
<h3 class="signature first" id="add-instance_method">
|
|
356
|
+
|
|
357
|
+
#<strong>add</strong>(row) ⇒ <tt>Object</tt>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
</h3><table class="source_code">
|
|
364
|
+
<tr>
|
|
365
|
+
<td>
|
|
366
|
+
<pre class="lines">
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
59
|
|
370
|
+
60
|
|
371
|
+
61
|
|
372
|
+
62
|
|
373
|
+
63
|
|
374
|
+
64
|
|
375
|
+
65
|
|
376
|
+
66
|
|
377
|
+
67
|
|
378
|
+
68
|
|
379
|
+
69
|
|
380
|
+
70</pre>
|
|
381
|
+
</td>
|
|
382
|
+
<td>
|
|
383
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 59</span>
|
|
384
|
+
|
|
385
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
|
386
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_add_first_match'>add_first_match</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@first_match</span>
|
|
387
|
+
|
|
388
|
+
<span class='comment'># Accumulate output rows
|
|
389
|
+
</span> <span class='ivar'>@rows_picked</span> <span class='op'><<</span> <span class='id identifier rubyid_row'>row</span>
|
|
390
|
+
<span class='ivar'>@outs</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>
|
|
391
|
+
<span class='id identifier rubyid_accumulate_outs'>accumulate_outs</span><span class='lparen'>(</span><span class='label'>column_name:</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>cell:</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
392
|
+
<span class='kw'>end</span>
|
|
393
|
+
|
|
394
|
+
<span class='comment'># Not done
|
|
395
|
+
</span> <span class='kw'>false</span>
|
|
396
|
+
<span class='kw'>end</span></pre>
|
|
397
|
+
</td>
|
|
398
|
+
</tr>
|
|
399
|
+
</table>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<div class="method_details ">
|
|
403
|
+
<h3 class="signature " id="empty?-instance_method">
|
|
404
|
+
|
|
405
|
+
#<strong>empty?</strong> ⇒ <tt>Boolean</tt>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
</h3><div class="docstring">
|
|
412
|
+
<div class="discussion">
|
|
413
|
+
|
|
414
|
+
<p>Is the result set empty? That is, nothing matched?</p>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
<div class="tags">
|
|
420
|
+
|
|
421
|
+
<p class="tag_title">Returns:</p>
|
|
422
|
+
<ul class="return">
|
|
423
|
+
|
|
424
|
+
<li>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
</li>
|
|
432
|
+
|
|
433
|
+
</ul>
|
|
434
|
+
|
|
435
|
+
</div><table class="source_code">
|
|
436
|
+
<tr>
|
|
437
|
+
<td>
|
|
438
|
+
<pre class="lines">
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
31
|
|
442
|
+
32
|
|
443
|
+
33
|
|
444
|
+
34</pre>
|
|
445
|
+
</td>
|
|
446
|
+
<td>
|
|
447
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 31</span>
|
|
448
|
+
|
|
449
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
|
|
450
|
+
<span class='kw'>return</span> <span class='ivar'>@row_picked</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>if</span> <span class='ivar'>@first_match</span>
|
|
451
|
+
<span class='ivar'>@rows_picked</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
452
|
+
<span class='kw'>end</span></pre>
|
|
453
|
+
</td>
|
|
454
|
+
</tr>
|
|
455
|
+
</table>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
<div class="method_details ">
|
|
459
|
+
<h3 class="signature " id="exist?-instance_method">
|
|
460
|
+
|
|
461
|
+
#<strong>exist?</strong> ⇒ <tt>Boolean</tt>
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
</h3><div class="docstring">
|
|
468
|
+
<div class="discussion">
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
<div class="tags">
|
|
474
|
+
|
|
475
|
+
<p class="tag_title">Returns:</p>
|
|
476
|
+
<ul class="return">
|
|
477
|
+
|
|
478
|
+
<li>
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
</li>
|
|
486
|
+
|
|
487
|
+
</ul>
|
|
488
|
+
|
|
489
|
+
</div><table class="source_code">
|
|
490
|
+
<tr>
|
|
491
|
+
<td>
|
|
492
|
+
<pre class="lines">
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
36
|
|
496
|
+
37
|
|
497
|
+
38</pre>
|
|
498
|
+
</td>
|
|
499
|
+
<td>
|
|
500
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 36</span>
|
|
501
|
+
|
|
502
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_exist?'>exist?</span>
|
|
503
|
+
<span class='op'>!</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
504
|
+
<span class='kw'>end</span></pre>
|
|
505
|
+
</td>
|
|
506
|
+
</tr>
|
|
507
|
+
</table>
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
<div class="method_details ">
|
|
511
|
+
<h3 class="signature " id="result-instance_method">
|
|
512
|
+
|
|
513
|
+
#<strong>result</strong> ⇒ <tt>Object</tt>
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
</h3><table class="source_code">
|
|
520
|
+
<tr>
|
|
521
|
+
<td>
|
|
522
|
+
<pre class="lines">
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
40
|
|
526
|
+
41
|
|
527
|
+
42
|
|
528
|
+
43
|
|
529
|
+
44
|
|
530
|
+
45</pre>
|
|
531
|
+
</td>
|
|
532
|
+
<td>
|
|
533
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 40</span>
|
|
534
|
+
|
|
535
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_result'>result</span>
|
|
536
|
+
<span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_empty?'>empty?</span>
|
|
537
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_final_result'>final_result</span> <span class='kw'>unless</span> <span class='ivar'>@outs_functions</span>
|
|
538
|
+
|
|
539
|
+
<span class='kw'>nil</span>
|
|
540
|
+
<span class='kw'>end</span></pre>
|
|
541
|
+
</td>
|
|
542
|
+
</tr>
|
|
543
|
+
</table>
|
|
544
|
+
</div>
|
|
545
|
+
|
|
546
|
+
<div class="method_details ">
|
|
547
|
+
<h3 class="signature " id="scan-instance_method">
|
|
548
|
+
|
|
549
|
+
#<strong>scan</strong>(table:, input:) ⇒ <tt>Object</tt>
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
</h3><table class="source_code">
|
|
556
|
+
<tr>
|
|
557
|
+
<td>
|
|
558
|
+
<pre class="lines">
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
47
|
|
562
|
+
48
|
|
563
|
+
49
|
|
564
|
+
50
|
|
565
|
+
51
|
|
566
|
+
52
|
|
567
|
+
53
|
|
568
|
+
54
|
|
569
|
+
55
|
|
570
|
+
56
|
|
571
|
+
57</pre>
|
|
572
|
+
</td>
|
|
573
|
+
<td>
|
|
574
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/decision.rb', line 47</span>
|
|
575
|
+
|
|
576
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>input:</span><span class='rparen'>)</span>
|
|
577
|
+
<span class='id identifier rubyid_scan_rows'>scan_rows</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_scan_rows'>scan_rows</span>
|
|
578
|
+
|
|
579
|
+
<span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
|
580
|
+
<span class='id identifier rubyid_done'>done</span> <span class='op'>=</span> <span class='id identifier rubyid_row_scan'>row_scan</span><span class='lparen'>(</span><span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='label'>scan_row:</span> <span class='id identifier rubyid_scan_rows'>scan_rows</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
581
|
+
|
|
582
|
+
<span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_done'>done</span>
|
|
583
|
+
<span class='kw'>end</span>
|
|
584
|
+
|
|
585
|
+
<span class='kw'>self</span>
|
|
586
|
+
<span class='kw'>end</span></pre>
|
|
587
|
+
</td>
|
|
588
|
+
</tr>
|
|
589
|
+
</table>
|
|
590
|
+
</div>
|
|
591
|
+
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
<div id="footer">
|
|
597
|
+
Generated on Tue Dec 26 18:31:38 2017 by
|
|
598
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
599
|
+
0.9.12 (ruby-2.3.0).
|
|
600
|
+
</div>
|
|
601
|
+
|
|
602
|
+
</div>
|
|
603
|
+
</body>
|
|
604
|
+
</html>
|