csv_decision2 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.codeclimate.yml +3 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +85 -0
- data/Dockerfile +6 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +356 -0
- data/benchmarks/rufus_decision.rb +158 -0
- data/csv_decision2.gemspec +38 -0
- data/doc/CSVDecision/CellValidationError.html +143 -0
- data/doc/CSVDecision/Columns/Default.html +589 -0
- data/doc/CSVDecision/Columns/Dictionary.html +801 -0
- data/doc/CSVDecision/Columns/Entry.html +508 -0
- data/doc/CSVDecision/Columns.html +1259 -0
- data/doc/CSVDecision/Constant.html +254 -0
- data/doc/CSVDecision/Data.html +479 -0
- data/doc/CSVDecision/Decide.html +302 -0
- data/doc/CSVDecision/Decision.html +1011 -0
- data/doc/CSVDecision/Defaults.html +291 -0
- data/doc/CSVDecision/Dictionary/Entry.html +1147 -0
- data/doc/CSVDecision/Dictionary.html +426 -0
- data/doc/CSVDecision/Error.html +139 -0
- data/doc/CSVDecision/FileError.html +143 -0
- data/doc/CSVDecision/Function.html +240 -0
- data/doc/CSVDecision/Guard.html +245 -0
- data/doc/CSVDecision/Header.html +647 -0
- data/doc/CSVDecision/Index.html +741 -0
- data/doc/CSVDecision/Input.html +404 -0
- data/doc/CSVDecision/Load.html +296 -0
- data/doc/CSVDecision/Matchers/Constant.html +484 -0
- data/doc/CSVDecision/Matchers/Function.html +511 -0
- data/doc/CSVDecision/Matchers/Guard.html +503 -0
- data/doc/CSVDecision/Matchers/Matcher.html +507 -0
- data/doc/CSVDecision/Matchers/Numeric.html +415 -0
- data/doc/CSVDecision/Matchers/Pattern.html +491 -0
- data/doc/CSVDecision/Matchers/Proc.html +704 -0
- data/doc/CSVDecision/Matchers/Range.html +379 -0
- data/doc/CSVDecision/Matchers/Symbol.html +426 -0
- data/doc/CSVDecision/Matchers.html +1567 -0
- data/doc/CSVDecision/Numeric.html +259 -0
- data/doc/CSVDecision/Options.html +443 -0
- data/doc/CSVDecision/Parse.html +282 -0
- data/doc/CSVDecision/Paths.html +742 -0
- data/doc/CSVDecision/Result.html +1200 -0
- data/doc/CSVDecision/Scan/InputHashes.html +369 -0
- data/doc/CSVDecision/Scan.html +313 -0
- data/doc/CSVDecision/ScanRow.html +866 -0
- data/doc/CSVDecision/Symbol.html +256 -0
- data/doc/CSVDecision/Table.html +1470 -0
- data/doc/CSVDecision/TableValidationError.html +143 -0
- data/doc/CSVDecision/Validate.html +422 -0
- data/doc/CSVDecision.html +621 -0
- data/doc/_index.html +471 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +499 -0
- data/doc/file.README.html +421 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +421 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1163 -0
- data/doc/top-level-namespace.html +110 -0
- data/docker-compose.yml +13 -0
- data/lib/csv_decision/columns.rb +192 -0
- data/lib/csv_decision/data.rb +92 -0
- data/lib/csv_decision/decision.rb +196 -0
- data/lib/csv_decision/defaults.rb +47 -0
- data/lib/csv_decision/dictionary.rb +180 -0
- data/lib/csv_decision/header.rb +83 -0
- data/lib/csv_decision/index.rb +107 -0
- data/lib/csv_decision/input.rb +121 -0
- data/lib/csv_decision/load.rb +36 -0
- data/lib/csv_decision/matchers/constant.rb +74 -0
- data/lib/csv_decision/matchers/function.rb +56 -0
- data/lib/csv_decision/matchers/guard.rb +142 -0
- data/lib/csv_decision/matchers/numeric.rb +44 -0
- data/lib/csv_decision/matchers/pattern.rb +94 -0
- data/lib/csv_decision/matchers/range.rb +95 -0
- data/lib/csv_decision/matchers/symbol.rb +149 -0
- data/lib/csv_decision/matchers.rb +220 -0
- data/lib/csv_decision/options.rb +124 -0
- data/lib/csv_decision/parse.rb +165 -0
- data/lib/csv_decision/paths.rb +78 -0
- data/lib/csv_decision/result.rb +204 -0
- data/lib/csv_decision/scan.rb +117 -0
- data/lib/csv_decision/scan_row.rb +142 -0
- data/lib/csv_decision/table.rb +101 -0
- data/lib/csv_decision/validate.rb +85 -0
- data/lib/csv_decision.rb +45 -0
- data/spec/csv_decision/columns_spec.rb +251 -0
- data/spec/csv_decision/constant_spec.rb +36 -0
- data/spec/csv_decision/data_spec.rb +50 -0
- data/spec/csv_decision/decision_spec.rb +19 -0
- data/spec/csv_decision/examples_spec.rb +242 -0
- data/spec/csv_decision/index_spec.rb +58 -0
- data/spec/csv_decision/input_spec.rb +55 -0
- data/spec/csv_decision/load_spec.rb +28 -0
- data/spec/csv_decision/matchers/function_spec.rb +82 -0
- data/spec/csv_decision/matchers/guard_spec.rb +170 -0
- data/spec/csv_decision/matchers/numeric_spec.rb +47 -0
- data/spec/csv_decision/matchers/pattern_spec.rb +183 -0
- data/spec/csv_decision/matchers/range_spec.rb +70 -0
- data/spec/csv_decision/matchers/symbol_spec.rb +67 -0
- data/spec/csv_decision/options_spec.rb +94 -0
- data/spec/csv_decision/parse_spec.rb +44 -0
- data/spec/csv_decision/table_spec.rb +683 -0
- data/spec/csv_decision_spec.rb +7 -0
- data/spec/data/invalid/empty.csv +0 -0
- data/spec/data/invalid/invalid_header1.csv +4 -0
- data/spec/data/invalid/invalid_header2.csv +4 -0
- data/spec/data/invalid/invalid_header3.csv +4 -0
- data/spec/data/invalid/invalid_header4.csv +4 -0
- data/spec/data/valid/benchmark_regexp.csv +10 -0
- data/spec/data/valid/index_example.csv +13 -0
- data/spec/data/valid/multi_column_index.csv +10 -0
- data/spec/data/valid/multi_column_index2.csv +12 -0
- data/spec/data/valid/options_in_file1.csv +5 -0
- data/spec/data/valid/options_in_file2.csv +5 -0
- data/spec/data/valid/options_in_file3.csv +13 -0
- data/spec/data/valid/regular_expressions.csv +11 -0
- data/spec/data/valid/simple_constants.csv +5 -0
- data/spec/data/valid/simple_example.csv +10 -0
- data/spec/data/valid/valid.csv +4 -0
- data/spec/spec_helper.rb +106 -0
- metadata +352 -0
@@ -0,0 +1,741 @@
|
|
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::Index
|
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::Index";
|
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 (I)</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">Index</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::Index
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">CSVDecision::Index</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/index.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p class="note private">
|
105
|
+
<strong>This class is part of a private API.</strong>
|
106
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
<p>Build an index for a decision table with one or more input columns
|
110
|
+
designated as keys</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
123
|
+
<ul class="summary">
|
124
|
+
|
125
|
+
<li class="public ">
|
126
|
+
<span class="summary_signature">
|
127
|
+
|
128
|
+
<a href="#columns-instance_method" title="#columns (instance method)">#<strong>columns</strong> ⇒ Array<Integer> </a>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<span class="note title readonly">readonly</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="private note title">private</span>
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'>
|
148
|
+
<p>Array of column indices.</p>
|
149
|
+
</div></span>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#hash-instance_method" title="#hash (instance method)">#<strong>hash</strong> ⇒ Hash </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<span class="note title readonly">readonly</span>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<span class="private note title">private</span>
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'>
|
177
|
+
<p>The index hash mapping in input values to one or more data array row
|
178
|
+
indexes.</p>
|
179
|
+
</div></span>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
|
184
|
+
</ul>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<h2>
|
191
|
+
Class Method Summary
|
192
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
193
|
+
</h2>
|
194
|
+
|
195
|
+
<ul class="summary">
|
196
|
+
|
197
|
+
<li class="public ">
|
198
|
+
<span class="summary_signature">
|
199
|
+
|
200
|
+
<a href="#build-class_method" title="build (class method)">.<strong>build</strong>(table:) ⇒ CSVDecision::Index </a>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</span>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<span class="private note title">private</span>
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'>
|
215
|
+
<p>Build the index on the designated number of input columns.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#value-class_method" title="value (class method)">.<strong>value</strong>(current_value, index) ⇒ Integer, Array </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<span class="private note title">private</span>
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'>
|
239
|
+
<p>New index key value.</p>
|
240
|
+
</div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
</ul>
|
246
|
+
|
247
|
+
<h2>
|
248
|
+
Instance Method Summary
|
249
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
250
|
+
</h2>
|
251
|
+
|
252
|
+
<ul class="summary">
|
253
|
+
|
254
|
+
<li class="public ">
|
255
|
+
<span class="summary_signature">
|
256
|
+
|
257
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(table:, columns:) ⇒ Index </a>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</span>
|
262
|
+
|
263
|
+
|
264
|
+
<span class="note title constructor">constructor</span>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="private note title">private</span>
|
271
|
+
|
272
|
+
|
273
|
+
<span class="summary_desc"><div class='inline'>
|
274
|
+
<p>A new instance of Index.</p>
|
275
|
+
</div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
</ul>
|
281
|
+
|
282
|
+
|
283
|
+
<div id="constructor_details" class="method_details_list">
|
284
|
+
<h2>Constructor Details</h2>
|
285
|
+
|
286
|
+
<div class="method_details first">
|
287
|
+
<h3 class="signature first" id="initialize-instance_method">
|
288
|
+
|
289
|
+
#<strong>initialize</strong>(table:, columns:) ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::Index (class)">Index</a></span></tt>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</h3><div class="docstring">
|
296
|
+
<div class="discussion">
|
297
|
+
<p class="note private">
|
298
|
+
<strong>This method is part of a private API.</strong>
|
299
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
300
|
+
</p>
|
301
|
+
|
302
|
+
<p>Returns a new instance of Index</p>
|
303
|
+
|
304
|
+
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
<div class="tags">
|
308
|
+
<p class="tag_title">Parameters:</p>
|
309
|
+
<ul class="param">
|
310
|
+
|
311
|
+
<li>
|
312
|
+
|
313
|
+
<span class='name'>table</span>
|
314
|
+
|
315
|
+
|
316
|
+
<span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
—
|
321
|
+
<div class='inline'>
|
322
|
+
<p>Decision table.</p>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</li>
|
326
|
+
|
327
|
+
<li>
|
328
|
+
|
329
|
+
<span class='name'>columns</span>
|
330
|
+
|
331
|
+
|
332
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="" title="CSVDecision::Index (class)">Index</a></span>></tt>)</span>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
—
|
337
|
+
<div class='inline'>
|
338
|
+
<p>Array of column indexes to be indexed.</p>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</li>
|
342
|
+
|
343
|
+
</ul>
|
344
|
+
|
345
|
+
|
346
|
+
</div><table class="source_code">
|
347
|
+
<tr>
|
348
|
+
<td>
|
349
|
+
<pre class="lines">
|
350
|
+
|
351
|
+
|
352
|
+
79
|
353
|
+
80
|
354
|
+
81
|
355
|
+
82
|
356
|
+
83
|
357
|
+
84
|
358
|
+
85
|
359
|
+
86</pre>
|
360
|
+
</td>
|
361
|
+
<td>
|
362
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/index.rb', line 79</span>
|
363
|
+
|
364
|
+
<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'>columns:</span><span class='rparen'>)</span>
|
365
|
+
<span class='ivar'>@columns</span> <span class='op'>=</span> <span class='id identifier rubyid_columns'>columns</span>
|
366
|
+
<span class='ivar'>@hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
367
|
+
|
368
|
+
<span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='rparen'>)</span>
|
369
|
+
|
370
|
+
<span class='id identifier rubyid_freeze'>freeze</span>
|
371
|
+
<span class='kw'>end</span></pre>
|
372
|
+
</td>
|
373
|
+
</tr>
|
374
|
+
</table>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
</div>
|
378
|
+
|
379
|
+
<div id="instance_attr_details" class="attr_details">
|
380
|
+
<h2>Instance Attribute Details</h2>
|
381
|
+
|
382
|
+
|
383
|
+
<span id=""></span>
|
384
|
+
<div class="method_details first">
|
385
|
+
<h3 class="signature first" id="columns-instance_method">
|
386
|
+
|
387
|
+
#<strong>columns</strong> ⇒ <tt>Array<Integer></tt> <span class="extras">(readonly)</span>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
</h3><div class="docstring">
|
394
|
+
<div class="discussion">
|
395
|
+
<p class="note private">
|
396
|
+
<strong>This method is part of a private API.</strong>
|
397
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
398
|
+
</p>
|
399
|
+
|
400
|
+
<p>Returns Array of column indices</p>
|
401
|
+
|
402
|
+
|
403
|
+
</div>
|
404
|
+
</div>
|
405
|
+
<div class="tags">
|
406
|
+
|
407
|
+
<p class="tag_title">Returns:</p>
|
408
|
+
<ul class="return">
|
409
|
+
|
410
|
+
<li>
|
411
|
+
|
412
|
+
|
413
|
+
<span class='type'>(<tt>Array<Integer></tt>)</span>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
—
|
418
|
+
<div class='inline'>
|
419
|
+
<p>Array of column indices</p>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
</li>
|
423
|
+
|
424
|
+
</ul>
|
425
|
+
|
426
|
+
</div><table class="source_code">
|
427
|
+
<tr>
|
428
|
+
<td>
|
429
|
+
<pre class="lines">
|
430
|
+
|
431
|
+
|
432
|
+
75
|
433
|
+
76
|
434
|
+
77</pre>
|
435
|
+
</td>
|
436
|
+
<td>
|
437
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/index.rb', line 75</span>
|
438
|
+
|
439
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_columns'>columns</span>
|
440
|
+
<span class='ivar'>@columns</span>
|
441
|
+
<span class='kw'>end</span></pre>
|
442
|
+
</td>
|
443
|
+
</tr>
|
444
|
+
</table>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
|
448
|
+
<span id=""></span>
|
449
|
+
<div class="method_details ">
|
450
|
+
<h3 class="signature " id="hash-instance_method">
|
451
|
+
|
452
|
+
#<strong>hash</strong> ⇒ <tt>Hash</tt> <span class="extras">(readonly)</span>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
</h3><div class="docstring">
|
459
|
+
<div class="discussion">
|
460
|
+
<p class="note private">
|
461
|
+
<strong>This method is part of a private API.</strong>
|
462
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
463
|
+
</p>
|
464
|
+
|
465
|
+
<p>Returns The index hash mapping in input values to one or more data array
|
466
|
+
row indexes.</p>
|
467
|
+
|
468
|
+
|
469
|
+
</div>
|
470
|
+
</div>
|
471
|
+
<div class="tags">
|
472
|
+
|
473
|
+
<p class="tag_title">Returns:</p>
|
474
|
+
<ul class="return">
|
475
|
+
|
476
|
+
<li>
|
477
|
+
|
478
|
+
|
479
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
—
|
484
|
+
<div class='inline'>
|
485
|
+
<p>The index hash mapping in input values to one or more data array row
|
486
|
+
indexes.</p>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</li>
|
490
|
+
|
491
|
+
</ul>
|
492
|
+
|
493
|
+
</div><table class="source_code">
|
494
|
+
<tr>
|
495
|
+
<td>
|
496
|
+
<pre class="lines">
|
497
|
+
|
498
|
+
|
499
|
+
72
|
500
|
+
73
|
501
|
+
74</pre>
|
502
|
+
</td>
|
503
|
+
<td>
|
504
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/index.rb', line 72</span>
|
505
|
+
|
506
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hash'>hash</span>
|
507
|
+
<span class='ivar'>@hash</span>
|
508
|
+
<span class='kw'>end</span></pre>
|
509
|
+
</td>
|
510
|
+
</tr>
|
511
|
+
</table>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div id="class_method_details" class="method_details_list">
|
518
|
+
<h2>Class Method Details</h2>
|
519
|
+
|
520
|
+
|
521
|
+
<div class="method_details first">
|
522
|
+
<h3 class="signature first" id="build-class_method">
|
523
|
+
|
524
|
+
.<strong>build</strong>(table:) ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::Index (class)">CSVDecision::Index</a></span></tt>
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
</h3><div class="docstring">
|
531
|
+
<div class="discussion">
|
532
|
+
<p class="note private">
|
533
|
+
<strong>This method is part of a private API.</strong>
|
534
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
535
|
+
</p>
|
536
|
+
|
537
|
+
<p>Build the index on the designated number of input columns.</p>
|
538
|
+
|
539
|
+
|
540
|
+
</div>
|
541
|
+
</div>
|
542
|
+
<div class="tags">
|
543
|
+
<p class="tag_title">Parameters:</p>
|
544
|
+
<ul class="param">
|
545
|
+
|
546
|
+
<li>
|
547
|
+
|
548
|
+
<span class='name'>table</span>
|
549
|
+
|
550
|
+
|
551
|
+
<span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
—
|
556
|
+
<div class='inline'>
|
557
|
+
<p>Decision table being indexed.</p>
|
558
|
+
</div>
|
559
|
+
|
560
|
+
</li>
|
561
|
+
|
562
|
+
</ul>
|
563
|
+
|
564
|
+
<p class="tag_title">Returns:</p>
|
565
|
+
<ul class="return">
|
566
|
+
|
567
|
+
<li>
|
568
|
+
|
569
|
+
|
570
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="CSVDecision::Index (class)">CSVDecision::Index</a></span></tt>)</span>
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
—
|
575
|
+
<div class='inline'>
|
576
|
+
<p>The built index.</p>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
</li>
|
580
|
+
|
581
|
+
</ul>
|
582
|
+
|
583
|
+
</div><table class="source_code">
|
584
|
+
<tr>
|
585
|
+
<td>
|
586
|
+
<pre class="lines">
|
587
|
+
|
588
|
+
|
589
|
+
16
|
590
|
+
17
|
591
|
+
18
|
592
|
+
19
|
593
|
+
20
|
594
|
+
21
|
595
|
+
22
|
596
|
+
23
|
597
|
+
24
|
598
|
+
25
|
599
|
+
26
|
600
|
+
27</pre>
|
601
|
+
</td>
|
602
|
+
<td>
|
603
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/index.rb', line 16</span>
|
604
|
+
|
605
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='label'>table:</span><span class='rparen'>)</span>
|
606
|
+
<span class='comment'># Do we even have an index?
|
607
|
+
</span> <span class='id identifier rubyid_key_cols'>key_cols</span> <span class='op'>=</span> <span class='id identifier rubyid_index_columns'>index_columns</span><span class='lparen'>(</span><span class='label'>columns:</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_ins'>ins</span><span class='rparen'>)</span>
|
608
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_key_cols'>key_cols</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
609
|
+
|
610
|
+
<span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="CSVDecision::Index (class)">Index</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="CSVDecision::Index#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>table:</span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>columns:</span> <span class='id identifier rubyid_key_cols'>key_cols</span><span class='rparen'>)</span>
|
611
|
+
|
612
|
+
<span class='comment'># Indexed columns do not need to be scanned
|
613
|
+
</span> <span class='id identifier rubyid_trim_scan_rows'>trim_scan_rows</span><span class='lparen'>(</span><span class='label'>scan_rows:</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_scan_rows'>scan_rows</span><span class='comma'>,</span> <span class='label'>index_columns:</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='rparen'>)</span>
|
614
|
+
|
615
|
+
<span class='id identifier rubyid_table'>table</span>
|
616
|
+
<span class='kw'>end</span></pre>
|
617
|
+
</td>
|
618
|
+
</tr>
|
619
|
+
</table>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
<div class="method_details ">
|
623
|
+
<h3 class="signature " id="value-class_method">
|
624
|
+
|
625
|
+
.<strong>value</strong>(current_value, index) ⇒ <tt>Integer</tt>, <tt>Array</tt>
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
</h3><div class="docstring">
|
632
|
+
<div class="discussion">
|
633
|
+
<p class="note private">
|
634
|
+
<strong>This method is part of a private API.</strong>
|
635
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
636
|
+
</p>
|
637
|
+
|
638
|
+
<p>Returns New index key value.</p>
|
639
|
+
|
640
|
+
|
641
|
+
</div>
|
642
|
+
</div>
|
643
|
+
<div class="tags">
|
644
|
+
<p class="tag_title">Parameters:</p>
|
645
|
+
<ul class="param">
|
646
|
+
|
647
|
+
<li>
|
648
|
+
|
649
|
+
<span class='name'>current_value</span>
|
650
|
+
|
651
|
+
|
652
|
+
<span class='type'>(<tt>Integer</tt>, <tt>Array</tt>)</span>
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
—
|
657
|
+
<div class='inline'>
|
658
|
+
<p>Current index key value.</p>
|
659
|
+
</div>
|
660
|
+
|
661
|
+
</li>
|
662
|
+
|
663
|
+
<li>
|
664
|
+
|
665
|
+
<span class='name'>index</span>
|
666
|
+
|
667
|
+
|
668
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
—
|
673
|
+
<div class='inline'>
|
674
|
+
<p>Array row index to be included in the table index entry.</p>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
</li>
|
678
|
+
|
679
|
+
</ul>
|
680
|
+
|
681
|
+
<p class="tag_title">Returns:</p>
|
682
|
+
<ul class="return">
|
683
|
+
|
684
|
+
<li>
|
685
|
+
|
686
|
+
|
687
|
+
<span class='type'>(<tt>Integer</tt>, <tt>Array</tt>)</span>
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
—
|
692
|
+
<div class='inline'>
|
693
|
+
<p>New index key value.</p>
|
694
|
+
</div>
|
695
|
+
|
696
|
+
</li>
|
697
|
+
|
698
|
+
</ul>
|
699
|
+
|
700
|
+
</div><table class="source_code">
|
701
|
+
<tr>
|
702
|
+
<td>
|
703
|
+
<pre class="lines">
|
704
|
+
|
705
|
+
|
706
|
+
32
|
707
|
+
33
|
708
|
+
34
|
709
|
+
35
|
710
|
+
36
|
711
|
+
37
|
712
|
+
38</pre>
|
713
|
+
</td>
|
714
|
+
<td>
|
715
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/index.rb', line 32</span>
|
716
|
+
|
717
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='lparen'>(</span><span class='id identifier rubyid_current_value'>current_value</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
718
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_integer_value'>integer_value</span><span class='lparen'>(</span><span class='id identifier rubyid_current_value'>current_value</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_current_value'>current_value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
|
719
|
+
|
720
|
+
<span class='id identifier rubyid_array_value'>array_value</span><span class='lparen'>(</span><span class='id identifier rubyid_current_value'>current_value</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
721
|
+
|
722
|
+
<span class='id identifier rubyid_current_value'>current_value</span>
|
723
|
+
<span class='kw'>end</span></pre>
|
724
|
+
</td>
|
725
|
+
</tr>
|
726
|
+
</table>
|
727
|
+
</div>
|
728
|
+
|
729
|
+
</div>
|
730
|
+
|
731
|
+
</div>
|
732
|
+
|
733
|
+
<div id="footer">
|
734
|
+
Generated on Sun Feb 11 10:26:07 2018 by
|
735
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
736
|
+
0.9.12 (ruby-2.4.0).
|
737
|
+
</div>
|
738
|
+
|
739
|
+
</div>
|
740
|
+
</body>
|
741
|
+
</html>
|