csv_decision2 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/README.md +16 -16
- data/benchmarks/rufus_decision.rb +5 -7
- data/csv_decision2.gemspec +2 -2
- data/doc/CSVDecision/CellValidationError.html +117 -110
- data/doc/CSVDecision/Columns/Default.html +537 -508
- data/doc/CSVDecision/Columns/Dictionary.html +729 -686
- data/doc/CSVDecision/Columns/Entry.html +457 -433
- data/doc/CSVDecision/Columns.html +1134 -1051
- data/doc/CSVDecision/Constant.html +205 -191
- data/doc/CSVDecision/Data.html +423 -398
- data/doc/CSVDecision/Decide.html +236 -225
- data/doc/CSVDecision/Decision.html +872 -825
- data/doc/CSVDecision/Defaults.html +243 -230
- data/doc/CSVDecision/Dictionary/Entry.html +1026 -964
- data/doc/CSVDecision/Dictionary.html +377 -355
- data/doc/CSVDecision/Error.html +116 -105
- data/doc/CSVDecision/FileError.html +117 -110
- data/doc/CSVDecision/Function.html +181 -168
- data/doc/CSVDecision/Guard.html +200 -185
- data/doc/CSVDecision/Header.html +557 -523
- data/doc/CSVDecision/Index.html +652 -617
- data/doc/CSVDecision/Input.html +329 -312
- data/doc/CSVDecision/Load.html +232 -220
- data/doc/CSVDecision/Matchers/Constant.html +432 -399
- data/doc/CSVDecision/Matchers/Function.html +451 -415
- data/doc/CSVDecision/Matchers/Guard.html +459 -424
- data/doc/CSVDecision/Matchers/Matcher.html +470 -426
- data/doc/CSVDecision/Matchers/Numeric.html +375 -346
- data/doc/CSVDecision/Matchers/Pattern.html +429 -396
- data/doc/CSVDecision/Matchers/Proc.html +617 -575
- data/doc/CSVDecision/Matchers/Range.html +331 -302
- data/doc/CSVDecision/Matchers/Symbol.html +386 -353
- data/doc/CSVDecision/Matchers.html +1509 -1393
- data/doc/CSVDecision/Numeric.html +201 -188
- data/doc/CSVDecision/Options.html +376 -357
- data/doc/CSVDecision/Parse.html +217 -204
- data/doc/CSVDecision/Paths.html +664 -629
- data/doc/CSVDecision/Result.html +1076 -1005
- data/doc/CSVDecision/Scan/InputHashes.html +305 -288
- data/doc/CSVDecision/Scan.html +262 -249
- data/doc/CSVDecision/ScanRow.html +749 -705
- data/doc/CSVDecision/Symbol.html +204 -191
- data/doc/CSVDecision/Table.html +1391 -1305
- data/doc/CSVDecision/TableValidationError.html +117 -110
- data/doc/CSVDecision/Validate.html +353 -337
- data/doc/CSVDecision.html +623 -552
- data/doc/_index.html +488 -448
- data/doc/class_list.html +250 -45
- data/doc/file.README.html +304 -278
- data/doc/index.html +304 -278
- data/doc/method_list.html +1159 -1017
- data/doc/top-level-namespace.html +79 -75
- data/lib/{csv_decision → csv_decision2}/columns.rb +7 -7
- data/lib/{csv_decision → csv_decision2}/data.rb +1 -1
- data/lib/{csv_decision → csv_decision2}/decision.rb +5 -5
- data/lib/{csv_decision → csv_decision2}/defaults.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/dictionary.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/header.rb +5 -5
- data/lib/{csv_decision → csv_decision2}/index.rb +5 -5
- data/lib/{csv_decision → csv_decision2}/input.rb +3 -3
- data/lib/{csv_decision → csv_decision2}/load.rb +6 -6
- data/lib/{csv_decision → csv_decision2}/matchers/constant.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/function.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/guard.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/numeric.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/pattern.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/range.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers/symbol.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/matchers.rb +5 -5
- data/lib/{csv_decision → csv_decision2}/options.rb +3 -3
- data/lib/{csv_decision → csv_decision2}/parse.rb +14 -14
- data/lib/{csv_decision → csv_decision2}/paths.rb +5 -5
- data/lib/{csv_decision → csv_decision2}/result.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/scan.rb +3 -3
- data/lib/{csv_decision → csv_decision2}/scan_row.rb +2 -2
- data/lib/{csv_decision → csv_decision2}/table.rb +8 -8
- data/lib/{csv_decision → csv_decision2}/validate.rb +2 -2
- data/lib/csv_decision2.rb +45 -0
- data/spec/{csv_decision → csv_decision2}/columns_spec.rb +44 -44
- data/spec/{csv_decision → csv_decision2}/constant_spec.rb +4 -4
- data/spec/{csv_decision → csv_decision2}/data_spec.rb +11 -11
- data/spec/{csv_decision → csv_decision2}/decision_spec.rb +6 -6
- data/spec/{csv_decision → csv_decision2}/examples_spec.rb +14 -14
- data/spec/{csv_decision → csv_decision2}/index_spec.rb +8 -8
- data/spec/{csv_decision → csv_decision2}/input_spec.rb +9 -9
- data/spec/{csv_decision → csv_decision2}/load_spec.rb +8 -8
- data/spec/{csv_decision → csv_decision2}/matchers/function_spec.rb +7 -7
- data/spec/{csv_decision → csv_decision2}/matchers/guard_spec.rb +14 -14
- data/spec/{csv_decision → csv_decision2}/matchers/numeric_spec.rb +5 -5
- data/spec/{csv_decision → csv_decision2}/matchers/pattern_spec.rb +6 -6
- data/spec/{csv_decision → csv_decision2}/matchers/range_spec.rb +5 -5
- data/spec/{csv_decision → csv_decision2}/matchers/symbol_spec.rb +6 -6
- data/spec/{csv_decision → csv_decision2}/options_spec.rb +18 -18
- data/spec/csv_decision2/parse_spec.rb +44 -0
- data/spec/{csv_decision → csv_decision2}/table_spec.rb +17 -17
- data/spec/csv_decision2_spec.rb +7 -0
- metadata +64 -64
- data/lib/csv_decision.rb +0 -45
- data/spec/csv_decision/parse_spec.rb +0 -44
- data/spec/csv_decision_spec.rb +0 -7
data/doc/CSVDecision/Data.html
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
|
4
|
-
|
5
|
-
<meta
|
6
|
-
<
|
7
|
-
|
8
|
-
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<title>
|
8
|
+
Module: CSVDecision2::Data
|
9
|
+
|
9
10
|
— Documentation by YARD 0.9.12
|
10
|
-
|
11
|
-
</title>
|
11
|
+
|
12
|
+
</title>
|
12
13
|
|
13
14
|
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
15
|
|
15
16
|
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
17
|
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
19
|
-
|
20
|
-
</script>
|
18
|
+
<script type="text/javascript" charset="utf-8">
|
19
|
+
pathId = "CSVDecision2::Data";
|
20
|
+
relpath = '../';
|
21
|
+
</script>
|
21
22
|
|
22
23
|
|
23
24
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
@@ -25,336 +26,356 @@
|
|
25
26
|
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
27
|
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
</head>
|
30
|
+
|
31
|
+
<body>
|
32
|
+
<div class="nav_wrap">
|
33
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
34
|
+
<div id="resizer"></div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="main" tabindex="-1">
|
38
|
+
<div id="header">
|
39
|
+
<div id="menu">
|
40
|
+
|
41
|
+
<a href="../_index.html">Index (D)</a> »
|
42
|
+
<span class='title'><span class='object_link'><a href="../CSVDecision2.html"
|
43
|
+
title="CSVDecision (module)">CSVDecision</a></span></span>
|
44
|
+
»
|
45
|
+
<span class="title">Data</span>
|
34
46
|
|
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">Data</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
47
|
</div>
|
61
48
|
|
62
|
-
<div id="
|
63
|
-
|
64
|
-
|
65
|
-
<span class="private note title">Private</span>
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
49
|
+
<div id="search">
|
50
|
+
|
51
|
+
<a class="full_list_link" id="class_list_link" href="../class_list.html">
|
69
52
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
53
|
+
<svg width="24" height="24">
|
54
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
56
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
57
|
+
</svg>
|
58
|
+
</a>
|
75
59
|
|
76
|
-
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
77
63
|
|
78
|
-
|
79
|
-
|
80
|
-
<dt>Defined in:</dt>
|
81
|
-
<dd>lib/csv_decision/data.rb</dd>
|
82
|
-
</dl>
|
83
|
-
|
84
|
-
</div>
|
64
|
+
<div id="content">
|
65
|
+
<h1>Module: CSVDecision2::Data
|
85
66
|
|
86
|
-
<h2>Overview</h2><div class="docstring">
|
87
|
-
<div class="discussion">
|
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
67
|
|
93
|
-
<
|
68
|
+
<span class="private note title">Private</span>
|
69
|
+
</h1>
|
70
|
+
<div class="box_info">
|
94
71
|
|
95
72
|
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
<div class="tags">
|
99
|
-
|
100
73
|
|
101
|
-
</div>
|
102
74
|
|
103
75
|
|
104
76
|
|
105
77
|
|
106
78
|
|
107
79
|
|
108
|
-
|
109
|
-
<h2>
|
110
|
-
Class Method Summary
|
111
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
112
|
-
</h2>
|
113
80
|
|
114
|
-
|
115
|
-
|
81
|
+
|
82
|
+
<dl>
|
83
|
+
<dt>Defined in:</dt>
|
84
|
+
<dd>lib/csv_decision2/data.rb</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<h2>Overview</h2>
|
90
|
+
<div class="docstring">
|
91
|
+
<div class="discussion">
|
92
|
+
<p class="note private">
|
93
|
+
<strong>This module is part of a private API.</strong>
|
94
|
+
You should avoid using this module if possible, as it may be removed or be changed in the future.
|
95
|
+
</p>
|
96
|
+
|
97
|
+
<p>Methods to load data from a file, CSV string or an array of arrays.</p>
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
<div class="tags">
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<h2>
|
114
|
+
Class Method Summary
|
115
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
116
|
+
</h2>
|
117
|
+
|
118
|
+
<ul class="summary">
|
119
|
+
|
116
120
|
<li class="public ">
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<
|
135
|
-
|
136
|
-
|
137
|
-
</
|
138
|
-
|
139
|
-
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#input_file%3F-class_method" title="input_file? (class method)">.<strong>input_file?</strong>(data)
|
124
|
+
⇒ Boolean </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<span class="private note title">private</span>
|
136
|
+
|
137
|
+
|
138
|
+
<span class="summary_desc">
|
139
|
+
<div class='inline'>
|
140
|
+
<p>If the input is a file name return true, otherwise false.</p>
|
141
|
+
</div>
|
142
|
+
</span>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
146
|
+
|
140
147
|
<li class="public ">
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
148
|
+
<span class="summary_signature">
|
149
|
+
|
150
|
+
<a href="#strip_columns-class_method"
|
151
|
+
title="strip_columns (class method)">.<strong>strip_columns</strong>(data:, empty_columns:) ⇒
|
152
|
+
Array<Array<String>> </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<span class="private note title">private</span>
|
164
|
+
|
165
|
+
|
166
|
+
<span class="summary_desc">
|
167
|
+
<div class='inline'>
|
168
|
+
<p>Strip the empty columns from the input data rows.</p>
|
169
|
+
</div>
|
170
|
+
</span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
164
175
|
<li class="public ">
|
165
|
-
|
166
|
-
|
167
|
-
<a href="#to_array-class_method" title="to_array (class method)">.<strong>to_array</strong>(data:) ⇒ Array<Array<String>> </a>
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
</span>
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
<span class="private note title">private</span>
|
179
|
-
|
180
|
-
|
181
|
-
<span class="summary_desc"><div class='inline'>
|
182
|
-
<p>Parse the input data which may either be a file path name, CSV string or
|
183
|
-
array of arrays.</p>
|
184
|
-
</div></span>
|
185
|
-
|
186
|
-
</li>
|
187
|
-
|
188
|
-
|
189
|
-
</ul>
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<div id="class_method_details" class="method_details_list">
|
195
|
-
<h2>Class Method Details</h2>
|
196
|
-
|
197
|
-
|
198
|
-
<div class="method_details first">
|
199
|
-
<h3 class="signature first" id="input_file?-class_method">
|
200
|
-
|
201
|
-
.<strong>input_file?</strong>(data) ⇒ <tt>Boolean</tt>
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
</h3><div class="docstring">
|
208
|
-
<div class="discussion">
|
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>
|
176
|
+
<span class="summary_signature">
|
215
177
|
|
178
|
+
<a href="#to_array-class_method" title="to_array (class method)">.<strong>to_array</strong>(data:) ⇒
|
179
|
+
Array<Array<String>> </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="private note title">private</span>
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc">
|
194
|
+
<div class='inline'>
|
195
|
+
<p>Parse the input data which may either be a file path name, CSV string or
|
196
|
+
array of arrays.</p>
|
197
|
+
</div>
|
198
|
+
</span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
</ul>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div id="class_method_details" class="method_details_list">
|
209
|
+
<h2>Class Method Details</h2>
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method_details first">
|
213
|
+
<h3 class="signature first" id="input_file?-class_method">
|
214
|
+
|
215
|
+
.<strong>input_file?</strong>(data) ⇒ <tt>Boolean</tt>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</h3>
|
222
|
+
<div class="docstring">
|
223
|
+
<div class="discussion">
|
224
|
+
<p class="note private">
|
225
|
+
<strong>This method is part of a private API.</strong>
|
226
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
227
|
+
</p>
|
228
|
+
|
229
|
+
<p>If the input is a file name return true, otherwise false.</p>
|
216
230
|
|
217
|
-
|
218
|
-
</div>
|
219
|
-
|
220
|
-
|
221
|
-
<
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
</
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
</
|
259
|
-
|
260
|
-
</
|
261
|
-
|
262
|
-
|
263
|
-
|
231
|
+
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
<div class="tags">
|
235
|
+
<p class="tag_title">Parameters:</p>
|
236
|
+
<ul class="param">
|
237
|
+
|
238
|
+
<li>
|
239
|
+
|
240
|
+
<span class='name'>data</span>
|
241
|
+
|
242
|
+
|
243
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>,
|
244
|
+
<tt>String</tt>)</span>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
—
|
249
|
+
<div class='inline'>
|
250
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
</li>
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
<p class="tag_title">Returns:</p>
|
258
|
+
<ul class="return">
|
259
|
+
|
260
|
+
<li>
|
261
|
+
|
262
|
+
|
263
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
—
|
268
|
+
<div class='inline'>
|
269
|
+
<p>Set to true if the input data is passed as a File or Pathname.</p>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
</ul>
|
275
|
+
|
276
|
+
</div>
|
277
|
+
<table class="source_code">
|
278
|
+
<tr>
|
279
|
+
<td>
|
280
|
+
<pre class="lines">
|
264
281
|
|
265
282
|
|
266
283
|
34
|
267
284
|
35
|
268
285
|
36</pre>
|
269
|
-
|
270
|
-
|
271
|
-
|
286
|
+
</td>
|
287
|
+
<td>
|
288
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision2/data.rb', line 34</span>
|
272
289
|
|
273
290
|
<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
291
|
<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>
|
275
292
|
<span class='kw'>end</span></pre>
|
276
|
-
|
277
|
-
|
278
|
-
</table>
|
279
|
-
</div>
|
280
|
-
|
281
|
-
<div class="method_details ">
|
282
|
-
<h3 class="signature " id="strip_columns-class_method">
|
283
|
-
|
284
|
-
.<strong>strip_columns</strong>(data:, empty_columns:) ⇒ <tt>Array<Array<String>></tt>
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
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>
|
293
|
+
</td>
|
294
|
+
</tr>
|
295
|
+
</table>
|
296
|
+
</div>
|
298
297
|
|
298
|
+
<div class="method_details ">
|
299
|
+
<h3 class="signature " id="strip_columns-class_method">
|
299
300
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
<
|
329
|
-
</
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
</
|
334
|
-
|
335
|
-
<
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
<p>
|
348
|
-
</div>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
</ul>
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
301
|
+
.<strong>strip_columns</strong>(data:, empty_columns:) ⇒ <tt>Array<Array<String>></tt>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</h3>
|
308
|
+
<div class="docstring">
|
309
|
+
<div class="discussion">
|
310
|
+
<p class="note private">
|
311
|
+
<strong>This method is part of a private API.</strong>
|
312
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
313
|
+
</p>
|
314
|
+
|
315
|
+
<p>Strip the empty columns from the input data rows.</p>
|
316
|
+
|
317
|
+
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
<div class="tags">
|
321
|
+
<p class="tag_title">Parameters:</p>
|
322
|
+
<ul class="param">
|
323
|
+
|
324
|
+
<li>
|
325
|
+
|
326
|
+
<span class='name'>empty_columns</span>
|
327
|
+
|
328
|
+
|
329
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="Index.html"
|
330
|
+
title="CSVDecision2::Index (class)">Index</a></span>></tt>)</span>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</li>
|
335
|
+
|
336
|
+
<li>
|
337
|
+
|
338
|
+
<span class='name'>data</span>
|
339
|
+
|
340
|
+
|
341
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>,
|
342
|
+
<tt>String</tt>)</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
—
|
347
|
+
<div class='inline'>
|
348
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
349
|
+
</div>
|
350
|
+
|
351
|
+
</li>
|
352
|
+
|
353
|
+
</ul>
|
354
|
+
|
355
|
+
<p class="tag_title">Returns:</p>
|
356
|
+
<ul class="return">
|
357
|
+
|
358
|
+
<li>
|
359
|
+
|
360
|
+
|
361
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
—
|
366
|
+
<div class='inline'>
|
367
|
+
<p>Data array stripped of empty columns.</p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</li>
|
371
|
+
|
372
|
+
</ul>
|
373
|
+
|
374
|
+
</div>
|
375
|
+
<table class="source_code">
|
376
|
+
<tr>
|
377
|
+
<td>
|
378
|
+
<pre class="lines">
|
358
379
|
|
359
380
|
|
360
381
|
43
|
@@ -364,9 +385,9 @@ array of arrays.</p>
|
|
364
385
|
47
|
365
386
|
48
|
366
387
|
49</pre>
|
367
|
-
|
368
|
-
|
369
|
-
|
388
|
+
</td>
|
389
|
+
<td>
|
390
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision2/data.rb', line 43</span>
|
370
391
|
|
371
392
|
<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>
|
372
393
|
<span class='comment'># Adjust column indices as we delete columns the rest shift to the left by 1
|
@@ -375,105 +396,109 @@ array of arrays.</p>
|
|
375
396
|
<span class='comment'># Delete all empty columns from the array of arrays
|
376
397
|
</span> <span class='id identifier rubyid_empty_columns'>empty_columns</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='op'>|</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_each_index'>each_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_col'>col</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
377
398
|
<span class='kw'>end</span></pre>
|
378
|
-
|
379
|
-
|
380
|
-
</table>
|
381
|
-
</div>
|
382
|
-
|
383
|
-
<div class="method_details ">
|
384
|
-
<h3 class="signature " id="to_array-class_method">
|
385
|
-
|
386
|
-
.<strong>to_array</strong>(data:) ⇒ <tt>Array<Array<String>></tt>
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
</h3><div class="docstring">
|
393
|
-
<div class="discussion">
|
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
|
-
|
399
|
-
<p>Parse the input data which may either be a file path name, CSV string or
|
400
|
-
array of arrays. Strips out empty columns/rows and comment cells.</p>
|
399
|
+
</td>
|
400
|
+
</tr>
|
401
|
+
</table>
|
402
|
+
</div>
|
401
403
|
|
404
|
+
<div class="method_details ">
|
405
|
+
<h3 class="signature " id="to_array-class_method">
|
406
|
+
|
407
|
+
.<strong>to_array</strong>(data:) ⇒ <tt>Array<Array<String>></tt>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</h3>
|
414
|
+
<div class="docstring">
|
415
|
+
<div class="discussion">
|
416
|
+
<p class="note private">
|
417
|
+
<strong>This method is part of a private API.</strong>
|
418
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
419
|
+
</p>
|
420
|
+
|
421
|
+
<p>Parse the input data which may either be a file path name, CSV string or
|
422
|
+
array of arrays. Strips out empty columns/rows and comment cells.</p>
|
423
|
+
|
424
|
+
|
425
|
+
</div>
|
426
|
+
</div>
|
427
|
+
<div class="tags">
|
428
|
+
<p class="tag_title">Parameters:</p>
|
429
|
+
<ul class="param">
|
430
|
+
|
431
|
+
<li>
|
432
|
+
|
433
|
+
<span class='name'>data</span>
|
402
434
|
|
403
|
-
|
404
|
-
</
|
405
|
-
<
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
<
|
440
|
-
|
441
|
-
|
442
|
-
</li>
|
443
|
-
|
444
|
-
</ul>
|
445
|
-
|
446
|
-
</div><table class="source_code">
|
447
|
-
<tr>
|
448
|
-
<td>
|
449
|
-
<pre class="lines">
|
435
|
+
|
436
|
+
<span class='type'>(<tt>Pathname</tt>, <tt>File</tt>, <tt>Array<Array<String>></tt>,
|
437
|
+
<tt>String</tt>)</span>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
—
|
442
|
+
<div class='inline'>
|
443
|
+
<p>input data given as a CSV file, array of arrays or CSV string.</p>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
</ul>
|
449
|
+
|
450
|
+
<p class="tag_title">Returns:</p>
|
451
|
+
<ul class="return">
|
452
|
+
|
453
|
+
<li>
|
454
|
+
|
455
|
+
|
456
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
—
|
461
|
+
<div class='inline'>
|
462
|
+
<p>Data array stripped of empty rows.</p>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
</li>
|
466
|
+
|
467
|
+
</ul>
|
468
|
+
|
469
|
+
</div>
|
470
|
+
<table class="source_code">
|
471
|
+
<tr>
|
472
|
+
<td>
|
473
|
+
<pre class="lines">
|
450
474
|
|
451
475
|
|
452
476
|
26
|
453
477
|
27
|
454
478
|
28</pre>
|
455
|
-
|
456
|
-
|
457
|
-
|
479
|
+
</td>
|
480
|
+
<td>
|
481
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision2/data.rb', line 26</span>
|
458
482
|
|
459
483
|
<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>
|
460
484
|
<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>
|
461
485
|
<span class='kw'>end</span></pre>
|
462
|
-
|
463
|
-
|
464
|
-
</table>
|
465
|
-
</div>
|
466
|
-
|
467
|
-
</div>
|
486
|
+
</td>
|
487
|
+
</tr>
|
488
|
+
</table>
|
489
|
+
</div>
|
468
490
|
|
469
|
-
</div>
|
491
|
+
</div>
|
470
492
|
|
471
|
-
|
472
|
-
Generated on Sun Feb 11 10:26:07 2018 by
|
473
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
474
|
-
0.9.12 (ruby-2.4.0).
|
475
|
-
</div>
|
493
|
+
</div>
|
476
494
|
|
495
|
+
<div id="footer">
|
496
|
+
Generated on Sun Feb 11 10:26:07 2018 by
|
497
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
498
|
+
0.9.12 (ruby-2.4.0).
|
477
499
|
</div>
|
478
|
-
|
479
|
-
</
|
500
|
+
|
501
|
+
</div>
|
502
|
+
</body>
|
503
|
+
|
504
|
+
</html>
|