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,520 @@
|
|
|
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
|
+
Module: CSVDecision::Header
|
|
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::Header";
|
|
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 (H)</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">Header</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>Module: CSVDecision::Header
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<dl>
|
|
80
|
+
<dt>Defined in:</dt>
|
|
81
|
+
<dd>lib/csv_decision/header.rb</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
|
87
|
+
<div class="discussion">
|
|
88
|
+
|
|
89
|
+
<p>Parse the CSV file's header row. These methods are only required at
|
|
90
|
+
table load time.</p>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div class="tags">
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
</div>
|
|
99
|
+
<h2>Constant Summary</h2>
|
|
100
|
+
<dl class="constants">
|
|
101
|
+
|
|
102
|
+
<dt id="COLUMN_TYPE-constant" class="">COLUMN_TYPE =
|
|
103
|
+
<div class="docstring">
|
|
104
|
+
<div class="discussion">
|
|
105
|
+
|
|
106
|
+
<p>Column types recognise din the header row.</p>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="tags">
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
</dt>
|
|
116
|
+
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>
|
|
117
|
+
\A(?<type>in|out|in/text|out/text)
|
|
118
|
+
\s*:\s*(?<name>\S?.*)\z
|
|
119
|
+
</span><span class='regexp_end'>}xi</span></span></pre></dd>
|
|
120
|
+
|
|
121
|
+
<dt id="COLUMN_NAME-constant" class="">COLUMN_NAME =
|
|
122
|
+
<div class="docstring">
|
|
123
|
+
<div class="discussion">
|
|
124
|
+
|
|
125
|
+
<p>Regular expression string for a column name. More lenient than a Ruby
|
|
126
|
+
method name - note any spaces will have been replaced with underscores.</p>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
<div class="tags">
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
</dt>
|
|
136
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\\w[\\w:/!?]*</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
137
|
+
|
|
138
|
+
<dt id="COLUMN_NAME_RE-constant" class="">COLUMN_NAME_RE =
|
|
139
|
+
<div class="docstring">
|
|
140
|
+
<div class="discussion">
|
|
141
|
+
|
|
142
|
+
<p>Column name regular expression.</p>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="tags">
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
</div>
|
|
151
|
+
</dt>
|
|
152
|
+
<dd><pre class="code"><span class='const'><span class='object_link'><a href="Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='period'>.</span><span class='id identifier rubyid_regexp'><span class='object_link'><a href="Matchers.html#regexp-class_method" title="CSVDecision::Matchers.regexp (method)">regexp</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#COLUMN_NAME-constant" title="CSVDecision::Header::COLUMN_NAME (constant)">COLUMN_NAME</a></span></span><span class='rparen'>)</span></pre></dd>
|
|
153
|
+
|
|
154
|
+
</dl>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<h2>
|
|
164
|
+
Class Method Summary
|
|
165
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
166
|
+
</h2>
|
|
167
|
+
|
|
168
|
+
<ul class="summary">
|
|
169
|
+
|
|
170
|
+
<li class="public ">
|
|
171
|
+
<span class="summary_signature">
|
|
172
|
+
|
|
173
|
+
<a href="#dictionary-class_method" title="dictionary (class method)">.<strong>dictionary</strong>(row:) ⇒ Hash<Hash> </a>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
</span>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
<span class="summary_desc"><div class='inline'>
|
|
188
|
+
<p>Classify and build a dictionary of all input and output columns.</p>
|
|
189
|
+
</div></span>
|
|
190
|
+
|
|
191
|
+
</li>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<li class="public ">
|
|
195
|
+
<span class="summary_signature">
|
|
196
|
+
|
|
197
|
+
<a href="#row%3F-class_method" title="row? (class method)">.<strong>row?</strong>(row) ⇒ Boolean </a>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
</span>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<span class="summary_desc"><div class='inline'>
|
|
212
|
+
<p>Check if the given row contains a recognisable header cell.</p>
|
|
213
|
+
</div></span>
|
|
214
|
+
|
|
215
|
+
</li>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
<li class="public ">
|
|
219
|
+
<span class="summary_signature">
|
|
220
|
+
|
|
221
|
+
<a href="#strip_empty_columns-class_method" title="strip_empty_columns (class method)">.<strong>strip_empty_columns</strong>(rows:) ⇒ Array<Array<String>> </a>
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
</span>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
<span class="summary_desc"><div class='inline'>
|
|
236
|
+
<p>Strip empty columns from all data rows.</p>
|
|
237
|
+
</div></span>
|
|
238
|
+
|
|
239
|
+
</li>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
</ul>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
<div id="class_method_details" class="method_details_list">
|
|
248
|
+
<h2>Class Method Details</h2>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
<div class="method_details first">
|
|
252
|
+
<h3 class="signature first" id="dictionary-class_method">
|
|
253
|
+
|
|
254
|
+
.<strong>dictionary</strong>(row:) ⇒ <tt>Hash<Hash></tt>
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</h3><div class="docstring">
|
|
261
|
+
<div class="discussion">
|
|
262
|
+
|
|
263
|
+
<p>Classify and build a dictionary of all input and output columns.</p>
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
<div class="tags">
|
|
269
|
+
<p class="tag_title">Parameters:</p>
|
|
270
|
+
<ul class="param">
|
|
271
|
+
|
|
272
|
+
<li>
|
|
273
|
+
|
|
274
|
+
<span class='name'>row</span>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
—
|
|
282
|
+
<div class='inline'>
|
|
283
|
+
<p>The header row after removing any empty columns.</p>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
</li>
|
|
287
|
+
|
|
288
|
+
</ul>
|
|
289
|
+
|
|
290
|
+
<p class="tag_title">Returns:</p>
|
|
291
|
+
<ul class="return">
|
|
292
|
+
|
|
293
|
+
<li>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
<span class='type'>(<tt>Hash<Hash></tt>)</span>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
—
|
|
301
|
+
<div class='inline'>
|
|
302
|
+
<p>Column dictionary is a hash of hashes.</p>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
</li>
|
|
306
|
+
|
|
307
|
+
</ul>
|
|
308
|
+
|
|
309
|
+
</div><table class="source_code">
|
|
310
|
+
<tr>
|
|
311
|
+
<td>
|
|
312
|
+
<pre class="lines">
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
57
|
|
316
|
+
58
|
|
317
|
+
59
|
|
318
|
+
60
|
|
319
|
+
61
|
|
320
|
+
62
|
|
321
|
+
63
|
|
322
|
+
64
|
|
323
|
+
65</pre>
|
|
324
|
+
</td>
|
|
325
|
+
<td>
|
|
326
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 57</span>
|
|
327
|
+
|
|
328
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dictionary'>dictionary</span><span class='lparen'>(</span><span class='label'>row:</span><span class='rparen'>)</span>
|
|
329
|
+
<span class='id identifier rubyid_dictionary'>dictionary</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">Columns</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Columns/Dictionary.html" title="CSVDecision::Columns::Dictionary (class)">Dictionary</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Columns/Dictionary.html#initialize-instance_method" title="CSVDecision::Columns::Dictionary#initialize (method)">new</a></span></span>
|
|
330
|
+
|
|
331
|
+
<span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cell'>cell</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
|
332
|
+
<span class='id identifier rubyid_dictionary'>dictionary</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_cell'>parse_cell</span><span class='lparen'>(</span><span class='label'>cell:</span> <span class='id identifier rubyid_cell'>cell</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='label'>dictionary:</span> <span class='id identifier rubyid_dictionary'>dictionary</span><span class='rparen'>)</span>
|
|
333
|
+
<span class='kw'>end</span>
|
|
334
|
+
|
|
335
|
+
<span class='id identifier rubyid_dictionary'>dictionary</span>
|
|
336
|
+
<span class='kw'>end</span></pre>
|
|
337
|
+
</td>
|
|
338
|
+
</tr>
|
|
339
|
+
</table>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<div class="method_details ">
|
|
343
|
+
<h3 class="signature " id="row?-class_method">
|
|
344
|
+
|
|
345
|
+
.<strong>row?</strong>(row) ⇒ <tt>Boolean</tt>
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</h3><div class="docstring">
|
|
352
|
+
<div class="discussion">
|
|
353
|
+
|
|
354
|
+
<p>Check if the given row contains a recognisable header cell.</p>
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="tags">
|
|
360
|
+
<p class="tag_title">Parameters:</p>
|
|
361
|
+
<ul class="param">
|
|
362
|
+
|
|
363
|
+
<li>
|
|
364
|
+
|
|
365
|
+
<span class='name'>row</span>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
—
|
|
373
|
+
<div class='inline'>
|
|
374
|
+
<p>Header row.</p>
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
</li>
|
|
378
|
+
|
|
379
|
+
</ul>
|
|
380
|
+
|
|
381
|
+
<p class="tag_title">Returns:</p>
|
|
382
|
+
<ul class="return">
|
|
383
|
+
|
|
384
|
+
<li>
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
—
|
|
392
|
+
<div class='inline'>
|
|
393
|
+
<p>Return true if the row looks like a header.</p>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
</li>
|
|
397
|
+
|
|
398
|
+
</ul>
|
|
399
|
+
|
|
400
|
+
</div><table class="source_code">
|
|
401
|
+
<tr>
|
|
402
|
+
<td>
|
|
403
|
+
<pre class="lines">
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
36
|
|
407
|
+
37
|
|
408
|
+
38</pre>
|
|
409
|
+
</td>
|
|
410
|
+
<td>
|
|
411
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 36</span>
|
|
412
|
+
|
|
413
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_row?'>row?</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
|
414
|
+
<span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cell'>cell</span><span class='op'>|</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#COLUMN_TYPE-constant" title="CSVDecision::Header::COLUMN_TYPE (constant)">COLUMN_TYPE</a></span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
415
|
+
<span class='kw'>end</span></pre>
|
|
416
|
+
</td>
|
|
417
|
+
</tr>
|
|
418
|
+
</table>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<div class="method_details ">
|
|
422
|
+
<h3 class="signature " id="strip_empty_columns-class_method">
|
|
423
|
+
|
|
424
|
+
.<strong>strip_empty_columns</strong>(rows:) ⇒ <tt>Array<Array<String>></tt>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
</h3><div class="docstring">
|
|
431
|
+
<div class="discussion">
|
|
432
|
+
|
|
433
|
+
<p>Strip empty columns from all data rows.</p>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
</div>
|
|
437
|
+
</div>
|
|
438
|
+
<div class="tags">
|
|
439
|
+
<p class="tag_title">Parameters:</p>
|
|
440
|
+
<ul class="param">
|
|
441
|
+
|
|
442
|
+
<li>
|
|
443
|
+
|
|
444
|
+
<span class='name'>rows</span>
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
—
|
|
452
|
+
<div class='inline'>
|
|
453
|
+
<p>Data rows.</p>
|
|
454
|
+
</div>
|
|
455
|
+
|
|
456
|
+
</li>
|
|
457
|
+
|
|
458
|
+
</ul>
|
|
459
|
+
|
|
460
|
+
<p class="tag_title">Returns:</p>
|
|
461
|
+
<ul class="return">
|
|
462
|
+
|
|
463
|
+
<li>
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
<span class='type'>(<tt>Array<Array<String>></tt>)</span>
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
—
|
|
471
|
+
<div class='inline'>
|
|
472
|
+
<p>Data array after removing any empty columns and the header row.</p>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
</li>
|
|
476
|
+
|
|
477
|
+
</ul>
|
|
478
|
+
|
|
479
|
+
</div><table class="source_code">
|
|
480
|
+
<tr>
|
|
481
|
+
<td>
|
|
482
|
+
<pre class="lines">
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
45
|
|
486
|
+
46
|
|
487
|
+
47
|
|
488
|
+
48
|
|
489
|
+
49
|
|
490
|
+
50
|
|
491
|
+
51</pre>
|
|
492
|
+
</td>
|
|
493
|
+
<td>
|
|
494
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 45</span>
|
|
495
|
+
|
|
496
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_strip_empty_columns'>strip_empty_columns</span><span class='lparen'>(</span><span class='label'>rows:</span><span class='rparen'>)</span>
|
|
497
|
+
<span class='id identifier rubyid_empty_cols'>empty_cols</span> <span class='op'>=</span> <span class='id identifier rubyid_empty_columns?'>empty_columns?</span><span class='lparen'>(</span><span class='label'>row:</span> <span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
|
|
498
|
+
<span class='const'><span class='object_link'><a href="Data.html" title="CSVDecision::Data (module)">Data</a></span></span><span class='period'>.</span><span class='id identifier rubyid_strip_columns'><span class='object_link'><a href="Data.html#strip_columns-class_method" title="CSVDecision::Data.strip_columns (method)">strip_columns</a></span></span><span class='lparen'>(</span><span class='label'>data:</span> <span class='id identifier rubyid_rows'>rows</span><span class='comma'>,</span> <span class='label'>empty_columns:</span> <span class='id identifier rubyid_empty_cols'>empty_cols</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_empty_cols'>empty_cols</span>
|
|
499
|
+
|
|
500
|
+
<span class='comment'># Remove header row from the data array.
|
|
501
|
+
</span> <span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
|
502
|
+
<span class='kw'>end</span></pre>
|
|
503
|
+
</td>
|
|
504
|
+
</tr>
|
|
505
|
+
</table>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
</div>
|
|
511
|
+
|
|
512
|
+
<div id="footer">
|
|
513
|
+
Generated on Tue Dec 26 18:31:37 2017 by
|
|
514
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
515
|
+
0.9.12 (ruby-2.3.0).
|
|
516
|
+
</div>
|
|
517
|
+
|
|
518
|
+
</div>
|
|
519
|
+
</body>
|
|
520
|
+
</html>
|