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.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +3 -0
  3. data/.coveralls.yml +2 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +30 -0
  7. data/.travis.yml +6 -0
  8. data/CHANGELOG.md +85 -0
  9. data/Dockerfile +6 -0
  10. data/Gemfile +7 -0
  11. data/LICENSE +21 -0
  12. data/README.md +356 -0
  13. data/benchmarks/rufus_decision.rb +158 -0
  14. data/csv_decision2.gemspec +38 -0
  15. data/doc/CSVDecision/CellValidationError.html +143 -0
  16. data/doc/CSVDecision/Columns/Default.html +589 -0
  17. data/doc/CSVDecision/Columns/Dictionary.html +801 -0
  18. data/doc/CSVDecision/Columns/Entry.html +508 -0
  19. data/doc/CSVDecision/Columns.html +1259 -0
  20. data/doc/CSVDecision/Constant.html +254 -0
  21. data/doc/CSVDecision/Data.html +479 -0
  22. data/doc/CSVDecision/Decide.html +302 -0
  23. data/doc/CSVDecision/Decision.html +1011 -0
  24. data/doc/CSVDecision/Defaults.html +291 -0
  25. data/doc/CSVDecision/Dictionary/Entry.html +1147 -0
  26. data/doc/CSVDecision/Dictionary.html +426 -0
  27. data/doc/CSVDecision/Error.html +139 -0
  28. data/doc/CSVDecision/FileError.html +143 -0
  29. data/doc/CSVDecision/Function.html +240 -0
  30. data/doc/CSVDecision/Guard.html +245 -0
  31. data/doc/CSVDecision/Header.html +647 -0
  32. data/doc/CSVDecision/Index.html +741 -0
  33. data/doc/CSVDecision/Input.html +404 -0
  34. data/doc/CSVDecision/Load.html +296 -0
  35. data/doc/CSVDecision/Matchers/Constant.html +484 -0
  36. data/doc/CSVDecision/Matchers/Function.html +511 -0
  37. data/doc/CSVDecision/Matchers/Guard.html +503 -0
  38. data/doc/CSVDecision/Matchers/Matcher.html +507 -0
  39. data/doc/CSVDecision/Matchers/Numeric.html +415 -0
  40. data/doc/CSVDecision/Matchers/Pattern.html +491 -0
  41. data/doc/CSVDecision/Matchers/Proc.html +704 -0
  42. data/doc/CSVDecision/Matchers/Range.html +379 -0
  43. data/doc/CSVDecision/Matchers/Symbol.html +426 -0
  44. data/doc/CSVDecision/Matchers.html +1567 -0
  45. data/doc/CSVDecision/Numeric.html +259 -0
  46. data/doc/CSVDecision/Options.html +443 -0
  47. data/doc/CSVDecision/Parse.html +282 -0
  48. data/doc/CSVDecision/Paths.html +742 -0
  49. data/doc/CSVDecision/Result.html +1200 -0
  50. data/doc/CSVDecision/Scan/InputHashes.html +369 -0
  51. data/doc/CSVDecision/Scan.html +313 -0
  52. data/doc/CSVDecision/ScanRow.html +866 -0
  53. data/doc/CSVDecision/Symbol.html +256 -0
  54. data/doc/CSVDecision/Table.html +1470 -0
  55. data/doc/CSVDecision/TableValidationError.html +143 -0
  56. data/doc/CSVDecision/Validate.html +422 -0
  57. data/doc/CSVDecision.html +621 -0
  58. data/doc/_index.html +471 -0
  59. data/doc/class_list.html +51 -0
  60. data/doc/css/common.css +1 -0
  61. data/doc/css/full_list.css +58 -0
  62. data/doc/css/style.css +499 -0
  63. data/doc/file.README.html +421 -0
  64. data/doc/file_list.html +56 -0
  65. data/doc/frames.html +17 -0
  66. data/doc/index.html +421 -0
  67. data/doc/js/app.js +248 -0
  68. data/doc/js/full_list.js +216 -0
  69. data/doc/js/jquery.js +4 -0
  70. data/doc/method_list.html +1163 -0
  71. data/doc/top-level-namespace.html +110 -0
  72. data/docker-compose.yml +13 -0
  73. data/lib/csv_decision/columns.rb +192 -0
  74. data/lib/csv_decision/data.rb +92 -0
  75. data/lib/csv_decision/decision.rb +196 -0
  76. data/lib/csv_decision/defaults.rb +47 -0
  77. data/lib/csv_decision/dictionary.rb +180 -0
  78. data/lib/csv_decision/header.rb +83 -0
  79. data/lib/csv_decision/index.rb +107 -0
  80. data/lib/csv_decision/input.rb +121 -0
  81. data/lib/csv_decision/load.rb +36 -0
  82. data/lib/csv_decision/matchers/constant.rb +74 -0
  83. data/lib/csv_decision/matchers/function.rb +56 -0
  84. data/lib/csv_decision/matchers/guard.rb +142 -0
  85. data/lib/csv_decision/matchers/numeric.rb +44 -0
  86. data/lib/csv_decision/matchers/pattern.rb +94 -0
  87. data/lib/csv_decision/matchers/range.rb +95 -0
  88. data/lib/csv_decision/matchers/symbol.rb +149 -0
  89. data/lib/csv_decision/matchers.rb +220 -0
  90. data/lib/csv_decision/options.rb +124 -0
  91. data/lib/csv_decision/parse.rb +165 -0
  92. data/lib/csv_decision/paths.rb +78 -0
  93. data/lib/csv_decision/result.rb +204 -0
  94. data/lib/csv_decision/scan.rb +117 -0
  95. data/lib/csv_decision/scan_row.rb +142 -0
  96. data/lib/csv_decision/table.rb +101 -0
  97. data/lib/csv_decision/validate.rb +85 -0
  98. data/lib/csv_decision.rb +45 -0
  99. data/spec/csv_decision/columns_spec.rb +251 -0
  100. data/spec/csv_decision/constant_spec.rb +36 -0
  101. data/spec/csv_decision/data_spec.rb +50 -0
  102. data/spec/csv_decision/decision_spec.rb +19 -0
  103. data/spec/csv_decision/examples_spec.rb +242 -0
  104. data/spec/csv_decision/index_spec.rb +58 -0
  105. data/spec/csv_decision/input_spec.rb +55 -0
  106. data/spec/csv_decision/load_spec.rb +28 -0
  107. data/spec/csv_decision/matchers/function_spec.rb +82 -0
  108. data/spec/csv_decision/matchers/guard_spec.rb +170 -0
  109. data/spec/csv_decision/matchers/numeric_spec.rb +47 -0
  110. data/spec/csv_decision/matchers/pattern_spec.rb +183 -0
  111. data/spec/csv_decision/matchers/range_spec.rb +70 -0
  112. data/spec/csv_decision/matchers/symbol_spec.rb +67 -0
  113. data/spec/csv_decision/options_spec.rb +94 -0
  114. data/spec/csv_decision/parse_spec.rb +44 -0
  115. data/spec/csv_decision/table_spec.rb +683 -0
  116. data/spec/csv_decision_spec.rb +7 -0
  117. data/spec/data/invalid/empty.csv +0 -0
  118. data/spec/data/invalid/invalid_header1.csv +4 -0
  119. data/spec/data/invalid/invalid_header2.csv +4 -0
  120. data/spec/data/invalid/invalid_header3.csv +4 -0
  121. data/spec/data/invalid/invalid_header4.csv +4 -0
  122. data/spec/data/valid/benchmark_regexp.csv +10 -0
  123. data/spec/data/valid/index_example.csv +13 -0
  124. data/spec/data/valid/multi_column_index.csv +10 -0
  125. data/spec/data/valid/multi_column_index2.csv +12 -0
  126. data/spec/data/valid/options_in_file1.csv +5 -0
  127. data/spec/data/valid/options_in_file2.csv +5 -0
  128. data/spec/data/valid/options_in_file3.csv +13 -0
  129. data/spec/data/valid/regular_expressions.csv +11 -0
  130. data/spec/data/valid/simple_constants.csv +5 -0
  131. data/spec/data/valid/simple_example.csv +10 -0
  132. data/spec/data/valid/valid.csv +4 -0
  133. data/spec/spec_helper.rb +106 -0
  134. metadata +352 -0
@@ -0,0 +1,647 @@
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
+ &mdash; 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> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span>
41
+ &raquo;
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
+ <span class="private note title">Private</span>
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
+ <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
+
93
+ <p>Parse the CSV file&#39;s header row. These methods are only required at
94
+ table load time.</p>
95
+
96
+
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+
102
+ </div>
103
+ <h2>Constant Summary</h2>
104
+ <dl class="constants">
105
+
106
+ <dt id="COLUMN_TYPE-constant" class="">COLUMN_TYPE =
107
+ <div class="docstring">
108
+ <div class="discussion">
109
+ <p class="note private">
110
+ <strong>This constant is part of a private API.</strong>
111
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
112
+ </p>
113
+
114
+ <p>Column types recognised in the header row.</p>
115
+
116
+
117
+ </div>
118
+ </div>
119
+ <div class="tags">
120
+
121
+
122
+ </div>
123
+ </dt>
124
+ <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>
125
+ \A(?&lt;type&gt;in/text|in|out/text|out|guard|if|set/nil\?|set/blank\?|set|path)
126
+ \s*:\s*(?&lt;name&gt;\S?.*)\z
127
+ </span><span class='regexp_end'>}xi</span></span></pre></dd>
128
+
129
+ <dt id="COLUMN_NAME-constant" class="">COLUMN_NAME =
130
+ <div class="docstring">
131
+ <div class="discussion">
132
+ <p class="note private">
133
+ <strong>This constant is part of a private API.</strong>
134
+ You should avoid using this constant if possible, as it may be removed or be changed in the future.
135
+ </p>
136
+
137
+ <p>Regular expression string for a column name. More lenient than a Ruby
138
+ method name - note any spaces will have been replaced with underscores.</p>
139
+
140
+
141
+ </div>
142
+ </div>
143
+ <div class="tags">
144
+
145
+
146
+ </div>
147
+ </dt>
148
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\w[\\w:/!?]*</span><span class='tstring_end'>&quot;</span></span></pre></dd>
149
+
150
+ </dl>
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ <h2>
160
+ Class Method Summary
161
+ <small><a href="#" class="summary_toggle">collapse</a></small>
162
+ </h2>
163
+
164
+ <ul class="summary">
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#column_name%3F-class_method" title="column_name? (class method)">.<strong>column_name?</strong>(column_name) &#x21d2; Boolean </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="private note title">private</span>
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'>
184
+ <p>Return true if column name is valid.</p>
185
+ </div></span>
186
+
187
+ </li>
188
+
189
+
190
+ <li class="public ">
191
+ <span class="summary_signature">
192
+
193
+ <a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(table:, matchers:) &#x21d2; CSVDecision::Columns </a>
194
+
195
+
196
+
197
+ </span>
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="private note title">private</span>
205
+
206
+
207
+ <span class="summary_desc"><div class='inline'>
208
+ <p>Parse the header row, and the defaults row if present.</p>
209
+ </div></span>
210
+
211
+ </li>
212
+
213
+
214
+ <li class="public ">
215
+ <span class="summary_signature">
216
+
217
+ <a href="#row%3F-class_method" title="row? (class method)">.<strong>row?</strong>(row) &#x21d2; Boolean </a>
218
+
219
+
220
+
221
+ </span>
222
+
223
+
224
+
225
+
226
+
227
+
228
+ <span class="private note title">private</span>
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'>
232
+ <p>Check if the given row contains a recognisable header cell.</p>
233
+ </div></span>
234
+
235
+ </li>
236
+
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#strip_empty_columns-class_method" title="strip_empty_columns (class method)">.<strong>strip_empty_columns</strong>(rows:) &#x21d2; Array&lt;Array&lt;String&gt;&gt; </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <span class="private note title">private</span>
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'>
256
+ <p>Strip empty columns from all data rows.</p>
257
+ </div></span>
258
+
259
+ </li>
260
+
261
+
262
+ </ul>
263
+
264
+
265
+
266
+
267
+ <div id="class_method_details" class="method_details_list">
268
+ <h2>Class Method Details</h2>
269
+
270
+
271
+ <div class="method_details first">
272
+ <h3 class="signature first" id="column_name?-class_method">
273
+
274
+ .<strong>column_name?</strong>(column_name) &#x21d2; <tt>Boolean</tt>
275
+
276
+
277
+
278
+
279
+
280
+ </h3><div class="docstring">
281
+ <div class="discussion">
282
+ <p class="note private">
283
+ <strong>This method is part of a private API.</strong>
284
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
285
+ </p>
286
+
287
+ <p>Return true if column name is valid.</p>
288
+
289
+
290
+ </div>
291
+ </div>
292
+ <div class="tags">
293
+ <p class="tag_title">Parameters:</p>
294
+ <ul class="param">
295
+
296
+ <li>
297
+
298
+ <span class='name'>column_name</span>
299
+
300
+
301
+ <span class='type'>(<tt>String</tt>)</span>
302
+
303
+
304
+
305
+ </li>
306
+
307
+ </ul>
308
+
309
+ <p class="tag_title">Returns:</p>
310
+ <ul class="return">
311
+
312
+ <li>
313
+
314
+
315
+ <span class='type'>(<tt>Boolean</tt>)</span>
316
+
317
+
318
+
319
+ </li>
320
+
321
+ </ul>
322
+
323
+ </div><table class="source_code">
324
+ <tr>
325
+ <td>
326
+ <pre class="lines">
327
+
328
+
329
+ 30
330
+ 31
331
+ 32</pre>
332
+ </td>
333
+ <td>
334
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 30</span>
335
+
336
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_column_name?'>column_name?</span><span class='lparen'>(</span><span class='id identifier rubyid_column_name'>column_name</span><span class='rparen'>)</span>
337
+ <span class='const'>COLUMN_NAME_RE</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_column_name'>column_name</span><span class='rparen'>)</span>
338
+ <span class='kw'>end</span></pre>
339
+ </td>
340
+ </tr>
341
+ </table>
342
+ </div>
343
+
344
+ <div class="method_details ">
345
+ <h3 class="signature " id="parse-class_method">
346
+
347
+ .<strong>parse</strong>(table:, matchers:) &#x21d2; <tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>
348
+
349
+
350
+
351
+
352
+
353
+ </h3><div class="docstring">
354
+ <div class="discussion">
355
+ <p class="note private">
356
+ <strong>This method is part of a private API.</strong>
357
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
358
+ </p>
359
+
360
+ <p>Parse the header row, and the defaults row if present.</p>
361
+
362
+
363
+ </div>
364
+ </div>
365
+ <div class="tags">
366
+ <p class="tag_title">Parameters:</p>
367
+ <ul class="param">
368
+
369
+ <li>
370
+
371
+ <span class='name'>table</span>
372
+
373
+
374
+ <span class='type'>(<tt><span class='object_link'><a href="Table.html" title="CSVDecision::Table (class)">CSVDecision::Table</a></span></tt>)</span>
375
+
376
+
377
+
378
+ &mdash;
379
+ <div class='inline'>
380
+ <p>Decision table being parsed.</p>
381
+ </div>
382
+
383
+ </li>
384
+
385
+ <li>
386
+
387
+ <span class='name'>matchers</span>
388
+
389
+
390
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Matchers/Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matchers::Matcher</a></span>&gt;</tt>)</span>
391
+
392
+
393
+
394
+ &mdash;
395
+ <div class='inline'>
396
+ <p>Array of special cell matchers.</p>
397
+ </div>
398
+
399
+ </li>
400
+
401
+ </ul>
402
+
403
+ <p class="tag_title">Returns:</p>
404
+ <ul class="return">
405
+
406
+ <li>
407
+
408
+
409
+ <span class='type'>(<tt><span class='object_link'><a href="Columns.html" title="CSVDecision::Columns (class)">CSVDecision::Columns</a></span></tt>)</span>
410
+
411
+
412
+
413
+ &mdash;
414
+ <div class='inline'>
415
+ <p>Table columns object.</p>
416
+ </div>
417
+
418
+ </li>
419
+
420
+ </ul>
421
+
422
+ </div><table class="source_code">
423
+ <tr>
424
+ <td>
425
+ <pre class="lines">
426
+
427
+
428
+ 59
429
+ 60
430
+ 61
431
+ 62
432
+ 63
433
+ 64
434
+ 65
435
+ 66
436
+ 67
437
+ 68
438
+ 69
439
+ 70</pre>
440
+ </td>
441
+ <td>
442
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 59</span>
443
+
444
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='label'>table:</span><span class='comma'>,</span> <span class='label'>matchers:</span><span class='rparen'>)</span>
445
+ <span class='comment'># Parse the header row
446
+ </span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></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='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Columns.html#initialize-instance_method" title="CSVDecision::Columns#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='rparen'>)</span>
447
+
448
+ <span class='comment'># Parse the defaults row if present
449
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span> <span class='kw'>if</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_defaults'>defaults</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
450
+
451
+ <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_defaults'>defaults</span> <span class='op'>=</span>
452
+ <span class='const'><span class='object_link'><a href="Defaults.html" title="CSVDecision::Defaults (module)">Defaults</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Defaults.html#parse-class_method" title="CSVDecision::Defaults.parse (method)">parse</a></span></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='comma'>,</span> <span class='label'>matchers:</span> <span class='id identifier rubyid_matchers'>matchers</span><span class='period'>.</span><span class='id identifier rubyid_outs'>outs</span><span class='comma'>,</span> <span class='label'>row:</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span><span class='rparen'>)</span>
453
+
454
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span>
455
+ <span class='kw'>end</span></pre>
456
+ </td>
457
+ </tr>
458
+ </table>
459
+ </div>
460
+
461
+ <div class="method_details ">
462
+ <h3 class="signature " id="row?-class_method">
463
+
464
+ .<strong>row?</strong>(row) &#x21d2; <tt>Boolean</tt>
465
+
466
+
467
+
468
+
469
+
470
+ </h3><div class="docstring">
471
+ <div class="discussion">
472
+ <p class="note private">
473
+ <strong>This method is part of a private API.</strong>
474
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
475
+ </p>
476
+
477
+ <p>Check if the given row contains a recognisable header cell.</p>
478
+
479
+
480
+ </div>
481
+ </div>
482
+ <div class="tags">
483
+ <p class="tag_title">Parameters:</p>
484
+ <ul class="param">
485
+
486
+ <li>
487
+
488
+ <span class='name'>row</span>
489
+
490
+
491
+ <span class='type'>(<tt>Array&lt;String&gt;</tt>)</span>
492
+
493
+
494
+
495
+ &mdash;
496
+ <div class='inline'>
497
+ <p>Header row.</p>
498
+ </div>
499
+
500
+ </li>
501
+
502
+ </ul>
503
+
504
+ <p class="tag_title">Returns:</p>
505
+ <ul class="return">
506
+
507
+ <li>
508
+
509
+
510
+ <span class='type'>(<tt>Boolean</tt>)</span>
511
+
512
+
513
+
514
+ &mdash;
515
+ <div class='inline'>
516
+ <p>Return true if the row looks like a header.</p>
517
+ </div>
518
+
519
+ </li>
520
+
521
+ </ul>
522
+
523
+ </div><table class="source_code">
524
+ <tr>
525
+ <td>
526
+ <pre class="lines">
527
+
528
+
529
+ 38
530
+ 39
531
+ 40</pre>
532
+ </td>
533
+ <td>
534
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 38</span>
535
+
536
+ <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>
537
+ <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cell'>cell</span><span class='op'>|</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='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
538
+ <span class='kw'>end</span></pre>
539
+ </td>
540
+ </tr>
541
+ </table>
542
+ </div>
543
+
544
+ <div class="method_details ">
545
+ <h3 class="signature " id="strip_empty_columns-class_method">
546
+
547
+ .<strong>strip_empty_columns</strong>(rows:) &#x21d2; <tt>Array&lt;Array&lt;String&gt;&gt;</tt>
548
+
549
+
550
+
551
+
552
+
553
+ </h3><div class="docstring">
554
+ <div class="discussion">
555
+ <p class="note private">
556
+ <strong>This method is part of a private API.</strong>
557
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
558
+ </p>
559
+
560
+ <p>Strip empty columns from all data rows.</p>
561
+
562
+
563
+ </div>
564
+ </div>
565
+ <div class="tags">
566
+ <p class="tag_title">Parameters:</p>
567
+ <ul class="param">
568
+
569
+ <li>
570
+
571
+ <span class='name'>rows</span>
572
+
573
+
574
+ <span class='type'>(<tt>Array&lt;Array&lt;String&gt;&gt;</tt>)</span>
575
+
576
+
577
+
578
+ &mdash;
579
+ <div class='inline'>
580
+ <p>Data rows.</p>
581
+ </div>
582
+
583
+ </li>
584
+
585
+ </ul>
586
+
587
+ <p class="tag_title">Returns:</p>
588
+ <ul class="return">
589
+
590
+ <li>
591
+
592
+
593
+ <span class='type'>(<tt>Array&lt;Array&lt;String&gt;&gt;</tt>)</span>
594
+
595
+
596
+
597
+ &mdash;
598
+ <div class='inline'>
599
+ <p>Data array after removing any empty columns and the header row.</p>
600
+ </div>
601
+
602
+ </li>
603
+
604
+ </ul>
605
+
606
+ </div><table class="source_code">
607
+ <tr>
608
+ <td>
609
+ <pre class="lines">
610
+
611
+
612
+ 47
613
+ 48
614
+ 49
615
+ 50
616
+ 51
617
+ 52
618
+ 53</pre>
619
+ </td>
620
+ <td>
621
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/header.rb', line 47</span>
622
+
623
+ <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>
624
+ <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>
625
+ <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>
626
+
627
+ <span class='comment'># Remove header row from the data array.
628
+ </span> <span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
629
+ <span class='kw'>end</span></pre>
630
+ </td>
631
+ </tr>
632
+ </table>
633
+ </div>
634
+
635
+ </div>
636
+
637
+ </div>
638
+
639
+ <div id="footer">
640
+ Generated on Sun Feb 11 10:26:07 2018 by
641
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
642
+ 0.9.12 (ruby-2.4.0).
643
+ </div>
644
+
645
+ </div>
646
+ </body>
647
+ </html>