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,1115 @@
|
|
|
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::Table
|
|
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::Table";
|
|
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 (T)</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">Table</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::Table
|
|
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::Table</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/table.rb</dd>
|
|
98
|
+
</dl>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
<p>Decision Table that accepts input hashes and makes decisions</p>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="tags">
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
118
|
+
<ul class="summary">
|
|
119
|
+
|
|
120
|
+
<li class="public ">
|
|
121
|
+
<span class="summary_signature">
|
|
122
|
+
|
|
123
|
+
<a href="#columns-instance_method" title="#columns (instance method)">#<strong>columns</strong> ⇒ CSVDecision::Columns </a>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</span>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<span class="summary_desc"><div class='inline'>
|
|
141
|
+
<p>Dictionary of all input and output columns.</p>
|
|
142
|
+
</div></span>
|
|
143
|
+
|
|
144
|
+
</li>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<li class="public ">
|
|
148
|
+
<span class="summary_signature">
|
|
149
|
+
|
|
150
|
+
<a href="#file-instance_method" title="#file (instance method)">#<strong>file</strong> ⇒ File, ... </a>
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
</span>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
<span class="summary_desc"><div class='inline'>
|
|
168
|
+
<p>File path name if decision table was loaded from a CSV file.</p>
|
|
169
|
+
</div></span>
|
|
170
|
+
|
|
171
|
+
</li>
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<li class="public ">
|
|
175
|
+
<span class="summary_signature">
|
|
176
|
+
|
|
177
|
+
<a href="#options-instance_method" title="#options (instance method)">#<strong>options</strong> ⇒ Hash </a>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
</span>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<span class="summary_desc"><div class='inline'>
|
|
195
|
+
<p>All options, explicitly set or defaulted, used to parse the table.</p>
|
|
196
|
+
</div></span>
|
|
197
|
+
|
|
198
|
+
</li>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<li class="public ">
|
|
202
|
+
<span class="summary_signature">
|
|
203
|
+
|
|
204
|
+
<a href="#outs_rows-instance_method" title="#outs_rows (instance method)">#<strong>outs_rows</strong> ⇒ Array<CSVDecision::ScanRow> </a>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
</span>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<span class="summary_desc"><div class='inline'>
|
|
222
|
+
<p>Used to implement outputting of final results.</p>
|
|
223
|
+
</div></span>
|
|
224
|
+
|
|
225
|
+
</li>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<li class="public ">
|
|
229
|
+
<span class="summary_signature">
|
|
230
|
+
|
|
231
|
+
<a href="#rows-instance_method" title="#rows (instance method)">#<strong>rows</strong> ⇒ Array<Array> </a>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
</span>
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<span class="summary_desc"><div class='inline'>
|
|
249
|
+
<p>Data rows after parsing.</p>
|
|
250
|
+
</div></span>
|
|
251
|
+
|
|
252
|
+
</li>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<li class="public ">
|
|
256
|
+
<span class="summary_signature">
|
|
257
|
+
|
|
258
|
+
<a href="#scan_rows-instance_method" title="#scan_rows (instance method)">#<strong>scan_rows</strong> ⇒ Array<CSVDecision::ScanRow> </a>
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
</span>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
<span class="summary_desc"><div class='inline'>
|
|
276
|
+
<p>Scanning objects used to implement input matching logic.</p>
|
|
277
|
+
</div></span>
|
|
278
|
+
|
|
279
|
+
</li>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
</ul>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<h2>
|
|
289
|
+
Instance Method Summary
|
|
290
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
291
|
+
</h2>
|
|
292
|
+
|
|
293
|
+
<ul class="summary">
|
|
294
|
+
|
|
295
|
+
<li class="public ">
|
|
296
|
+
<span class="summary_signature">
|
|
297
|
+
|
|
298
|
+
<a href="#decide-instance_method" title="#decide (instance method)">#<strong>decide</strong>(input) ⇒ Hash{Symbol => Object, Array<Object>} </a>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
</span>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<span class="summary_desc"><div class='inline'>
|
|
313
|
+
<p>Main public method for making decisions.</p>
|
|
314
|
+
</div></span>
|
|
315
|
+
|
|
316
|
+
</li>
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
<li class="public ">
|
|
320
|
+
<span class="summary_signature">
|
|
321
|
+
|
|
322
|
+
<a href="#decide!-instance_method" title="#decide! (instance method)">#<strong>decide!</strong>(input) ⇒ Hash{Symbol => Object, Array<Object>} </a>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
</span>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
<span class="summary_desc"><div class='inline'>
|
|
337
|
+
<p>Unsafe version of decide - will mutate the hash if <tt>set: column</tt> type is
|
|
338
|
+
used (planned feature).</p>
|
|
339
|
+
</div></span>
|
|
340
|
+
|
|
341
|
+
</li>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<li class="public ">
|
|
345
|
+
<span class="summary_signature">
|
|
346
|
+
|
|
347
|
+
<a href="#each-instance_method" title="#each (instance method)">#<strong>each</strong>(first = 0, last = @rows.count - 1) ⇒ Object </a>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</span>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<span class="summary_desc"><div class='inline'>
|
|
362
|
+
<p>Iterate through all data rows of the decision table, with an optional first
|
|
363
|
+
and last row index given.</p>
|
|
364
|
+
</div></span>
|
|
365
|
+
|
|
366
|
+
</li>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<li class="public ">
|
|
370
|
+
<span class="summary_signature">
|
|
371
|
+
|
|
372
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Table </a>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
</span>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
<span class="note title constructor">constructor</span>
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
<span class="summary_desc"><div class='inline'>
|
|
389
|
+
<p>A new instance of Table.</p>
|
|
390
|
+
</div></span>
|
|
391
|
+
|
|
392
|
+
</li>
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
</ul>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<div id="constructor_details" class="method_details_list">
|
|
399
|
+
<h2>Constructor Details</h2>
|
|
400
|
+
|
|
401
|
+
<div class="method_details first">
|
|
402
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
403
|
+
|
|
404
|
+
#<strong>initialize</strong> ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::Table (class)">Table</a></span></tt>
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
</h3><div class="docstring">
|
|
411
|
+
<div class="discussion">
|
|
412
|
+
|
|
413
|
+
<p>Returns a new instance of Table</p>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
<div class="tags">
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
</div><table class="source_code">
|
|
422
|
+
<tr>
|
|
423
|
+
<td>
|
|
424
|
+
<pre class="lines">
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
68
|
|
428
|
+
69
|
|
429
|
+
70
|
|
430
|
+
71
|
|
431
|
+
72
|
|
432
|
+
73
|
|
433
|
+
74
|
|
434
|
+
75
|
|
435
|
+
76
|
|
436
|
+
77
|
|
437
|
+
78</pre>
|
|
438
|
+
</td>
|
|
439
|
+
<td>
|
|
440
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 68</span>
|
|
441
|
+
|
|
442
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
|
443
|
+
<span class='ivar'>@columns</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
444
|
+
<span class='ivar'>@file</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
445
|
+
<span class='ivar'>@matchers</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
446
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
447
|
+
<span class='ivar'>@outs_functions</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
448
|
+
<span class='ivar'>@outs_rows</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
449
|
+
<span class='ivar'>@rows</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
450
|
+
<span class='ivar'>@scan_rows</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
451
|
+
<span class='ivar'>@tables</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
452
|
+
<span class='kw'>end</span></pre>
|
|
453
|
+
</td>
|
|
454
|
+
</tr>
|
|
455
|
+
</table>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
</div>
|
|
459
|
+
|
|
460
|
+
<div id="instance_attr_details" class="attr_details">
|
|
461
|
+
<h2>Instance Attribute Details</h2>
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
<span id="columns=-instance_method"></span>
|
|
465
|
+
<div class="method_details first">
|
|
466
|
+
<h3 class="signature first" id="columns-instance_method">
|
|
467
|
+
|
|
468
|
+
#<strong>columns</strong> ⇒ <tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
</h3><div class="docstring">
|
|
475
|
+
<div class="discussion">
|
|
476
|
+
|
|
477
|
+
<p>Returns Dictionary of all input and output columns.</p>
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
<div class="tags">
|
|
483
|
+
|
|
484
|
+
<p class="tag_title">Returns:</p>
|
|
485
|
+
<ul class="return">
|
|
486
|
+
|
|
487
|
+
<li>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
<span class='type'>(<tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>)</span>
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
—
|
|
495
|
+
<div class='inline'>
|
|
496
|
+
<p>Dictionary of all input and output columns.</p>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
</li>
|
|
500
|
+
|
|
501
|
+
</ul>
|
|
502
|
+
|
|
503
|
+
</div><table class="source_code">
|
|
504
|
+
<tr>
|
|
505
|
+
<td>
|
|
506
|
+
<pre class="lines">
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
10
|
|
510
|
+
11
|
|
511
|
+
12</pre>
|
|
512
|
+
</td>
|
|
513
|
+
<td>
|
|
514
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 10</span>
|
|
515
|
+
|
|
516
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_columns'>columns</span>
|
|
517
|
+
<span class='ivar'>@columns</span>
|
|
518
|
+
<span class='kw'>end</span></pre>
|
|
519
|
+
</td>
|
|
520
|
+
</tr>
|
|
521
|
+
</table>
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
<span id="file=-instance_method"></span>
|
|
526
|
+
<div class="method_details ">
|
|
527
|
+
<h3 class="signature " id="file-instance_method">
|
|
528
|
+
|
|
529
|
+
#<strong>file</strong> ⇒ <tt>File</tt>, ...
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
</h3><div class="docstring">
|
|
536
|
+
<div class="discussion">
|
|
537
|
+
|
|
538
|
+
<p>Returns File path name if decision table was loaded from a CSV file.</p>
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
<div class="tags">
|
|
544
|
+
|
|
545
|
+
<p class="tag_title">Returns:</p>
|
|
546
|
+
<ul class="return">
|
|
547
|
+
|
|
548
|
+
<li>
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
<span class='type'>(<tt>File</tt>, <tt>Pathname</tt>, <tt>nil</tt>)</span>
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
—
|
|
556
|
+
<div class='inline'>
|
|
557
|
+
<p>File path name if decision table was loaded from a CSV file.</p>
|
|
558
|
+
</div>
|
|
559
|
+
|
|
560
|
+
</li>
|
|
561
|
+
|
|
562
|
+
</ul>
|
|
563
|
+
|
|
564
|
+
</div><table class="source_code">
|
|
565
|
+
<tr>
|
|
566
|
+
<td>
|
|
567
|
+
<pre class="lines">
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
13
|
|
571
|
+
14
|
|
572
|
+
15</pre>
|
|
573
|
+
</td>
|
|
574
|
+
<td>
|
|
575
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 13</span>
|
|
576
|
+
|
|
577
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_file'>file</span>
|
|
578
|
+
<span class='ivar'>@file</span>
|
|
579
|
+
<span class='kw'>end</span></pre>
|
|
580
|
+
</td>
|
|
581
|
+
</tr>
|
|
582
|
+
</table>
|
|
583
|
+
</div>
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
<span id="options=-instance_method"></span>
|
|
587
|
+
<div class="method_details ">
|
|
588
|
+
<h3 class="signature " id="options-instance_method">
|
|
589
|
+
|
|
590
|
+
#<strong>options</strong> ⇒ <tt>Hash</tt>
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
</h3><div class="docstring">
|
|
597
|
+
<div class="discussion">
|
|
598
|
+
|
|
599
|
+
<p>Returns All options, explicitly set or defaulted, used to parse the table.</p>
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
<div class="tags">
|
|
605
|
+
|
|
606
|
+
<p class="tag_title">Returns:</p>
|
|
607
|
+
<ul class="return">
|
|
608
|
+
|
|
609
|
+
<li>
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
—
|
|
617
|
+
<div class='inline'>
|
|
618
|
+
<p>All options, explicitly set or defaulted, used to parse the table.</p>
|
|
619
|
+
</div>
|
|
620
|
+
|
|
621
|
+
</li>
|
|
622
|
+
|
|
623
|
+
</ul>
|
|
624
|
+
|
|
625
|
+
</div><table class="source_code">
|
|
626
|
+
<tr>
|
|
627
|
+
<td>
|
|
628
|
+
<pre class="lines">
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
16
|
|
632
|
+
17
|
|
633
|
+
18</pre>
|
|
634
|
+
</td>
|
|
635
|
+
<td>
|
|
636
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 16</span>
|
|
637
|
+
|
|
638
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
|
639
|
+
<span class='ivar'>@options</span>
|
|
640
|
+
<span class='kw'>end</span></pre>
|
|
641
|
+
</td>
|
|
642
|
+
</tr>
|
|
643
|
+
</table>
|
|
644
|
+
</div>
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
<span id="outs_rows=-instance_method"></span>
|
|
648
|
+
<div class="method_details ">
|
|
649
|
+
<h3 class="signature " id="outs_rows-instance_method">
|
|
650
|
+
|
|
651
|
+
#<strong>outs_rows</strong> ⇒ <tt>Array<<span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">CSVDecision::ScanRow</a></span>></tt>
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
</h3><div class="docstring">
|
|
658
|
+
<div class="discussion">
|
|
659
|
+
|
|
660
|
+
<p>Returns Used to implement outputting of final results.</p>
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
<div class="tags">
|
|
666
|
+
|
|
667
|
+
<p class="tag_title">Returns:</p>
|
|
668
|
+
<ul class="return">
|
|
669
|
+
|
|
670
|
+
<li>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">CSVDecision::ScanRow</a></span>></tt>)</span>
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
—
|
|
678
|
+
<div class='inline'>
|
|
679
|
+
<p>Used to implement outputting of final results.</p>
|
|
680
|
+
</div>
|
|
681
|
+
|
|
682
|
+
</li>
|
|
683
|
+
|
|
684
|
+
</ul>
|
|
685
|
+
|
|
686
|
+
</div><table class="source_code">
|
|
687
|
+
<tr>
|
|
688
|
+
<td>
|
|
689
|
+
<pre class="lines">
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
28
|
|
693
|
+
29
|
|
694
|
+
30</pre>
|
|
695
|
+
</td>
|
|
696
|
+
<td>
|
|
697
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 28</span>
|
|
698
|
+
|
|
699
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_outs_rows'>outs_rows</span>
|
|
700
|
+
<span class='ivar'>@outs_rows</span>
|
|
701
|
+
<span class='kw'>end</span></pre>
|
|
702
|
+
</td>
|
|
703
|
+
</tr>
|
|
704
|
+
</table>
|
|
705
|
+
</div>
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
<span id="rows=-instance_method"></span>
|
|
709
|
+
<div class="method_details ">
|
|
710
|
+
<h3 class="signature " id="rows-instance_method">
|
|
711
|
+
|
|
712
|
+
#<strong>rows</strong> ⇒ <tt>Array<Array></tt>
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
</h3><div class="docstring">
|
|
719
|
+
<div class="discussion">
|
|
720
|
+
|
|
721
|
+
<p>Returns Data rows after parsing.</p>
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
</div>
|
|
725
|
+
</div>
|
|
726
|
+
<div class="tags">
|
|
727
|
+
|
|
728
|
+
<p class="tag_title">Returns:</p>
|
|
729
|
+
<ul class="return">
|
|
730
|
+
|
|
731
|
+
<li>
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
<span class='type'>(<tt>Array<Array></tt>)</span>
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
—
|
|
739
|
+
<div class='inline'>
|
|
740
|
+
<p>Data rows after parsing.</p>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
</li>
|
|
744
|
+
|
|
745
|
+
</ul>
|
|
746
|
+
|
|
747
|
+
</div><table class="source_code">
|
|
748
|
+
<tr>
|
|
749
|
+
<td>
|
|
750
|
+
<pre class="lines">
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
22
|
|
754
|
+
23
|
|
755
|
+
24</pre>
|
|
756
|
+
</td>
|
|
757
|
+
<td>
|
|
758
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 22</span>
|
|
759
|
+
|
|
760
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_rows'>rows</span>
|
|
761
|
+
<span class='ivar'>@rows</span>
|
|
762
|
+
<span class='kw'>end</span></pre>
|
|
763
|
+
</td>
|
|
764
|
+
</tr>
|
|
765
|
+
</table>
|
|
766
|
+
</div>
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
<span id="scan_rows=-instance_method"></span>
|
|
770
|
+
<div class="method_details ">
|
|
771
|
+
<h3 class="signature " id="scan_rows-instance_method">
|
|
772
|
+
|
|
773
|
+
#<strong>scan_rows</strong> ⇒ <tt>Array<<span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">CSVDecision::ScanRow</a></span>></tt>
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
</h3><div class="docstring">
|
|
780
|
+
<div class="discussion">
|
|
781
|
+
|
|
782
|
+
<p>Returns Scanning objects used to implement input matching logic.</p>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
</div>
|
|
786
|
+
</div>
|
|
787
|
+
<div class="tags">
|
|
788
|
+
|
|
789
|
+
<p class="tag_title">Returns:</p>
|
|
790
|
+
<ul class="return">
|
|
791
|
+
|
|
792
|
+
<li>
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="ScanRow.html" title="CSVDecision::ScanRow (class)">CSVDecision::ScanRow</a></span>></tt>)</span>
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
—
|
|
800
|
+
<div class='inline'>
|
|
801
|
+
<p>Scanning objects used to implement input matching logic.</p>
|
|
802
|
+
</div>
|
|
803
|
+
|
|
804
|
+
</li>
|
|
805
|
+
|
|
806
|
+
</ul>
|
|
807
|
+
|
|
808
|
+
</div><table class="source_code">
|
|
809
|
+
<tr>
|
|
810
|
+
<td>
|
|
811
|
+
<pre class="lines">
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
25
|
|
815
|
+
26
|
|
816
|
+
27</pre>
|
|
817
|
+
</td>
|
|
818
|
+
<td>
|
|
819
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 25</span>
|
|
820
|
+
|
|
821
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan_rows'>scan_rows</span>
|
|
822
|
+
<span class='ivar'>@scan_rows</span>
|
|
823
|
+
<span class='kw'>end</span></pre>
|
|
824
|
+
</td>
|
|
825
|
+
</tr>
|
|
826
|
+
</table>
|
|
827
|
+
</div>
|
|
828
|
+
|
|
829
|
+
</div>
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
<div id="instance_method_details" class="method_details_list">
|
|
833
|
+
<h2>Instance Method Details</h2>
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
<div class="method_details first">
|
|
837
|
+
<h3 class="signature first" id="decide-instance_method">
|
|
838
|
+
|
|
839
|
+
#<strong>decide</strong>(input) ⇒ <tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Symbol (module)">Symbol</a></span> => Object, Array<Object>}</tt>
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
</h3><div class="docstring">
|
|
846
|
+
<div class="discussion">
|
|
847
|
+
|
|
848
|
+
<div class="note notetag">
|
|
849
|
+
<strong>Note:</strong>
|
|
850
|
+
<div class='inline'>
|
|
851
|
+
<p>Input hash keys may or may not be symbolized.</p>
|
|
852
|
+
</div>
|
|
853
|
+
</div>
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
<p>Main public method for making decisions.</p>
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
</div>
|
|
860
|
+
</div>
|
|
861
|
+
<div class="tags">
|
|
862
|
+
<p class="tag_title">Parameters:</p>
|
|
863
|
+
<ul class="param">
|
|
864
|
+
|
|
865
|
+
<li>
|
|
866
|
+
|
|
867
|
+
<span class='name'>input</span>
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
—
|
|
875
|
+
<div class='inline'>
|
|
876
|
+
<p>Input hash.</p>
|
|
877
|
+
</div>
|
|
878
|
+
|
|
879
|
+
</li>
|
|
880
|
+
|
|
881
|
+
</ul>
|
|
882
|
+
|
|
883
|
+
<p class="tag_title">Returns:</p>
|
|
884
|
+
<ul class="return">
|
|
885
|
+
|
|
886
|
+
<li>
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Symbol (module)">Symbol</a></span> => Object, Array<Object>}</tt>)</span>
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
—
|
|
894
|
+
<div class='inline'>
|
|
895
|
+
<p>Decision hash.</p>
|
|
896
|
+
</div>
|
|
897
|
+
|
|
898
|
+
</li>
|
|
899
|
+
|
|
900
|
+
</ul>
|
|
901
|
+
|
|
902
|
+
</div><table class="source_code">
|
|
903
|
+
<tr>
|
|
904
|
+
<td>
|
|
905
|
+
<pre class="lines">
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
40
|
|
909
|
+
41
|
|
910
|
+
42</pre>
|
|
911
|
+
</td>
|
|
912
|
+
<td>
|
|
913
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 40</span>
|
|
914
|
+
|
|
915
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decide'>decide</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
|
|
916
|
+
<span class='const'><span class='object_link'><a href="Decide.html" title="CSVDecision::Decide (module)">Decide</a></span></span><span class='period'>.</span><span class='id identifier rubyid_decide'><span class='object_link'><a href="Decide.html#decide-class_method" title="CSVDecision::Decide.decide (method)">decide</a></span></span><span class='lparen'>(</span><span class='label'>table:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='label'>symbolize_keys:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span>
|
|
917
|
+
<span class='kw'>end</span></pre>
|
|
918
|
+
</td>
|
|
919
|
+
</tr>
|
|
920
|
+
</table>
|
|
921
|
+
</div>
|
|
922
|
+
|
|
923
|
+
<div class="method_details ">
|
|
924
|
+
<h3 class="signature " id="decide!-instance_method">
|
|
925
|
+
|
|
926
|
+
#<strong>decide!</strong>(input) ⇒ <tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Symbol (module)">Symbol</a></span> => Object, Array<Object>}</tt>
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
</h3><div class="docstring">
|
|
933
|
+
<div class="discussion">
|
|
934
|
+
|
|
935
|
+
<div class="note notetag">
|
|
936
|
+
<strong>Note:</strong>
|
|
937
|
+
<div class='inline'>
|
|
938
|
+
<p>Input hash must have its keys symbolized.</p>
|
|
939
|
+
</div>
|
|
940
|
+
</div>
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
<p>Unsafe version of decide - will mutate the hash if <tt>set: column</tt> type is
|
|
944
|
+
used (planned feature).</p>
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
</div>
|
|
948
|
+
</div>
|
|
949
|
+
<div class="tags">
|
|
950
|
+
<p class="tag_title">Parameters:</p>
|
|
951
|
+
<ul class="param">
|
|
952
|
+
|
|
953
|
+
<li>
|
|
954
|
+
|
|
955
|
+
<span class='name'>input</span>
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
—
|
|
963
|
+
<div class='inline'>
|
|
964
|
+
<p>Input hash.</p>
|
|
965
|
+
</div>
|
|
966
|
+
|
|
967
|
+
</li>
|
|
968
|
+
|
|
969
|
+
</ul>
|
|
970
|
+
|
|
971
|
+
<p class="tag_title">Returns:</p>
|
|
972
|
+
<ul class="return">
|
|
973
|
+
|
|
974
|
+
<li>
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Symbol (module)">Symbol</a></span> => Object, Array<Object>}</tt>)</span>
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
—
|
|
982
|
+
<div class='inline'>
|
|
983
|
+
<p>Decision hash.</p>
|
|
984
|
+
</div>
|
|
985
|
+
|
|
986
|
+
</li>
|
|
987
|
+
|
|
988
|
+
</ul>
|
|
989
|
+
|
|
990
|
+
</div><table class="source_code">
|
|
991
|
+
<tr>
|
|
992
|
+
<td>
|
|
993
|
+
<pre class="lines">
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
50
|
|
997
|
+
51
|
|
998
|
+
52</pre>
|
|
999
|
+
</td>
|
|
1000
|
+
<td>
|
|
1001
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 50</span>
|
|
1002
|
+
|
|
1003
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decide!'>decide!</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
|
|
1004
|
+
<span class='const'><span class='object_link'><a href="Decide.html" title="CSVDecision::Decide (module)">Decide</a></span></span><span class='period'>.</span><span class='id identifier rubyid_decide'><span class='object_link'><a href="Decide.html#decide-class_method" title="CSVDecision::Decide.decide (method)">decide</a></span></span><span class='lparen'>(</span><span class='label'>table:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>input:</span> <span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='label'>symbolize_keys:</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span>
|
|
1005
|
+
<span class='kw'>end</span></pre>
|
|
1006
|
+
</td>
|
|
1007
|
+
</tr>
|
|
1008
|
+
</table>
|
|
1009
|
+
</div>
|
|
1010
|
+
|
|
1011
|
+
<div class="method_details ">
|
|
1012
|
+
<h3 class="signature " id="each-instance_method">
|
|
1013
|
+
|
|
1014
|
+
#<strong>each</strong>(first = 0, last = @rows.count - 1) ⇒ <tt>Object</tt>
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
</h3><div class="docstring">
|
|
1021
|
+
<div class="discussion">
|
|
1022
|
+
|
|
1023
|
+
<p>Iterate through all data rows of the decision table, with an optional first
|
|
1024
|
+
and last row index given.</p>
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
</div>
|
|
1028
|
+
</div>
|
|
1029
|
+
<div class="tags">
|
|
1030
|
+
<p class="tag_title">Parameters:</p>
|
|
1031
|
+
<ul class="param">
|
|
1032
|
+
|
|
1033
|
+
<li>
|
|
1034
|
+
|
|
1035
|
+
<span class='name'>first</span>
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
—
|
|
1045
|
+
<div class='inline'>
|
|
1046
|
+
<p>Start row.</p>
|
|
1047
|
+
</div>
|
|
1048
|
+
|
|
1049
|
+
</li>
|
|
1050
|
+
|
|
1051
|
+
<li>
|
|
1052
|
+
|
|
1053
|
+
<span class='name'>last</span>
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
<span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
<em class="default">(defaults to: <tt>@rows.count - 1</tt>)</em>
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
—
|
|
1063
|
+
<div class='inline'>
|
|
1064
|
+
<p>Last row.</p>
|
|
1065
|
+
</div>
|
|
1066
|
+
|
|
1067
|
+
</li>
|
|
1068
|
+
|
|
1069
|
+
</ul>
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
</div><table class="source_code">
|
|
1073
|
+
<tr>
|
|
1074
|
+
<td>
|
|
1075
|
+
<pre class="lines">
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
59
|
|
1079
|
+
60
|
|
1080
|
+
61
|
|
1081
|
+
62
|
|
1082
|
+
63
|
|
1083
|
+
64
|
|
1084
|
+
65
|
|
1085
|
+
66</pre>
|
|
1086
|
+
</td>
|
|
1087
|
+
<td>
|
|
1088
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/table.rb', line 59</span>
|
|
1089
|
+
|
|
1090
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='id identifier rubyid_first'>first</span> <span class='op'>=</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_last'>last</span> <span class='op'>=</span> <span class='ivar'>@rows</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span>
|
|
1091
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_first'>first</span>
|
|
1092
|
+
<span class='kw'>while</span> <span class='id identifier rubyid_index'>index</span> <span class='op'><=</span> <span class='lparen'>(</span><span class='id identifier rubyid_last'>last</span> <span class='op'>||</span> <span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
|
|
1093
|
+
<span class='kw'>yield</span><span class='lparen'>(</span><span class='ivar'>@rows</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
|
1094
|
+
|
|
1095
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>+=</span> <span class='int'>1</span>
|
|
1096
|
+
<span class='kw'>end</span>
|
|
1097
|
+
<span class='kw'>end</span></pre>
|
|
1098
|
+
</td>
|
|
1099
|
+
</tr>
|
|
1100
|
+
</table>
|
|
1101
|
+
</div>
|
|
1102
|
+
|
|
1103
|
+
</div>
|
|
1104
|
+
|
|
1105
|
+
</div>
|
|
1106
|
+
|
|
1107
|
+
<div id="footer">
|
|
1108
|
+
Generated on Tue Dec 26 18:31:38 2017 by
|
|
1109
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1110
|
+
0.9.12 (ruby-2.3.0).
|
|
1111
|
+
</div>
|
|
1112
|
+
|
|
1113
|
+
</div>
|
|
1114
|
+
</body>
|
|
1115
|
+
</html>
|