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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -0
  3. data/.gitignore +2 -1
  4. data/.travis.yml +2 -3
  5. data/CHANGELOG.md +19 -1
  6. data/README.md +49 -16
  7. data/{benchmark.rb → benchmarks/rufus_decision.rb} +1 -1
  8. data/csv_decision.gemspec +1 -1
  9. data/doc/CSVDecision/CellValidationError.html +143 -0
  10. data/doc/CSVDecision/Columns/Default.html +409 -0
  11. data/doc/CSVDecision/Columns/Dictionary.html +410 -0
  12. data/doc/CSVDecision/Columns/Entry.html +321 -0
  13. data/doc/CSVDecision/Columns.html +476 -0
  14. data/doc/CSVDecision/Constant.html +295 -0
  15. data/doc/CSVDecision/Data.html +344 -0
  16. data/doc/CSVDecision/Decide.html +434 -0
  17. data/doc/CSVDecision/Decision.html +604 -0
  18. data/doc/CSVDecision/Error.html +139 -0
  19. data/doc/CSVDecision/FileError.html +143 -0
  20. data/doc/CSVDecision/Function.html +229 -0
  21. data/doc/CSVDecision/Header.html +520 -0
  22. data/doc/CSVDecision/Input.html +305 -0
  23. data/doc/CSVDecision/Load.html +225 -0
  24. data/doc/CSVDecision/Matchers/Constant.html +242 -0
  25. data/doc/CSVDecision/Matchers/Function.html +342 -0
  26. data/doc/CSVDecision/Matchers/Matcher.html +325 -0
  27. data/doc/CSVDecision/Matchers/Numeric.html +277 -0
  28. data/doc/CSVDecision/Matchers/Pattern.html +600 -0
  29. data/doc/CSVDecision/Matchers/Range.html +413 -0
  30. data/doc/CSVDecision/Matchers/Symbol.html +280 -0
  31. data/doc/CSVDecision/Matchers.html +1529 -0
  32. data/doc/CSVDecision/Numeric.html +259 -0
  33. data/doc/CSVDecision/Options.html +445 -0
  34. data/doc/CSVDecision/Parse.html +270 -0
  35. data/doc/CSVDecision/ScanRow.html +746 -0
  36. data/doc/CSVDecision/Symbol.html +256 -0
  37. data/doc/CSVDecision/Table.html +1115 -0
  38. data/doc/CSVDecision.html +652 -0
  39. data/doc/_index.html +410 -0
  40. data/doc/class_list.html +51 -0
  41. data/doc/css/common.css +1 -0
  42. data/doc/css/full_list.css +58 -0
  43. data/doc/css/style.css +499 -0
  44. data/doc/file.README.html +264 -0
  45. data/doc/file_list.html +56 -0
  46. data/doc/frames.html +17 -0
  47. data/doc/index.html +264 -0
  48. data/doc/js/app.js +248 -0
  49. data/doc/js/full_list.js +216 -0
  50. data/doc/js/jquery.js +4 -0
  51. data/doc/method_list.html +683 -0
  52. data/doc/top-level-namespace.html +110 -0
  53. data/lib/csv_decision/columns.rb +15 -12
  54. data/lib/csv_decision/constant.rb +54 -0
  55. data/lib/csv_decision/decide.rb +5 -5
  56. data/lib/csv_decision/decision.rb +3 -1
  57. data/lib/csv_decision/function.rb +32 -0
  58. data/lib/csv_decision/header.rb +27 -18
  59. data/lib/csv_decision/input.rb +11 -8
  60. data/lib/csv_decision/matchers/constant.rb +18 -0
  61. data/lib/csv_decision/matchers/function.rb +11 -44
  62. data/lib/csv_decision/matchers/numeric.rb +5 -33
  63. data/lib/csv_decision/matchers/pattern.rb +26 -11
  64. data/lib/csv_decision/matchers/range.rb +21 -5
  65. data/lib/csv_decision/matchers/symbol.rb +20 -0
  66. data/lib/csv_decision/matchers.rb +85 -20
  67. data/lib/csv_decision/numeric.rb +38 -0
  68. data/lib/csv_decision/options.rb +36 -27
  69. data/lib/csv_decision/parse.rb +46 -39
  70. data/lib/csv_decision/scan_row.rb +19 -7
  71. data/lib/csv_decision/symbol.rb +73 -0
  72. data/lib/csv_decision/table.rb +24 -18
  73. data/lib/csv_decision.rb +25 -18
  74. data/spec/csv_decision/columns_spec.rb +1 -1
  75. data/spec/csv_decision/constant_spec.rb +60 -0
  76. data/spec/csv_decision/examples_spec.rb +119 -0
  77. data/spec/csv_decision/matchers/function_spec.rb +48 -28
  78. data/spec/csv_decision/matchers/numeric_spec.rb +4 -41
  79. data/spec/csv_decision/matchers/range_spec.rb +31 -61
  80. data/spec/csv_decision/matchers/symbol_spec.rb +65 -0
  81. data/spec/csv_decision/options_spec.rb +14 -2
  82. data/spec/csv_decision/parse_spec.rb +10 -0
  83. data/spec/csv_decision/table_spec.rb +112 -6
  84. data/spec/data/valid/simple_constants.csv +3 -3
  85. metadata +62 -7
  86. data/spec/csv_decision/simple_example_spec.rb +0 -75
  87. /data/spec/{csv_decision.rb → csv_decision_spec.rb} +0 -0
@@ -0,0 +1,295 @@
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::Constant
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::Constant";
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 (C)</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">Constant</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::Constant
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/constant.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Recognise constant expressions in table data cells.</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+
97
+ </div>
98
+ <h2>Constant Summary</h2>
99
+ <dl class="constants">
100
+
101
+ <dt id="EXPRESSION-constant" class="">EXPRESSION =
102
+ <div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Cell constant expression specified by prefixing the value with one of the
106
+ three equality symbols.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+ </dt>
116
+ <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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>(?&lt;operator&gt;</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Matchers.html#EQUALS-constant" title="CSVDecision::Matchers::EQUALS (constant)">EQUALS</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>)\\s*(?&lt;value&gt;\\S.*)</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></pre></dd>
117
+
118
+ <dt id="NON_NUMERIC-constant" class="">NON_NUMERIC =
119
+ <div class="docstring">
120
+ <div class="discussion">
121
+
122
+ <p>Non-numeric constants recognised by CSV Decision.</p>
123
+
124
+
125
+ </div>
126
+ </div>
127
+ <div class="tags">
128
+
129
+
130
+ </div>
131
+ </dt>
132
+ <dd><pre class="code"><span class='lbrace'>{</span>
133
+ <span class='label'>nil:</span> <span class='kw'>nil</span><span class='comma'>,</span>
134
+ <span class='label'>true:</span> <span class='kw'>true</span><span class='comma'>,</span>
135
+ <span class='label'>false:</span> <span class='kw'>false</span>
136
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
137
+
138
+ </dl>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <h2>
148
+ Class Method Summary
149
+ <small><a href="#" class="summary_toggle">collapse</a></small>
150
+ </h2>
151
+
152
+ <ul class="summary">
153
+
154
+ <li class="public ">
155
+ <span class="summary_signature">
156
+
157
+ <a href="#matches%3F-class_method" title="matches? (class method)">.<strong>matches?</strong>(cell) &#x21d2; Boolean, ... </a>
158
+
159
+
160
+
161
+ </span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'></div></span>
172
+
173
+ </li>
174
+
175
+
176
+ </ul>
177
+
178
+
179
+
180
+
181
+ <div id="class_method_details" class="method_details_list">
182
+ <h2>Class Method Details</h2>
183
+
184
+
185
+ <div class="method_details first">
186
+ <h3 class="signature first" id="matches?-class_method">
187
+
188
+ .<strong>matches?</strong>(cell) &#x21d2; <tt>Boolean</tt>, ...
189
+
190
+
191
+
192
+
193
+
194
+ </h3><div class="docstring">
195
+ <div class="discussion">
196
+
197
+
198
+ </div>
199
+ </div>
200
+ <div class="tags">
201
+ <p class="tag_title">Parameters:</p>
202
+ <ul class="param">
203
+
204
+ <li>
205
+
206
+ <span class='name'>cell</span>
207
+
208
+
209
+ <span class='type'>(<tt>String</tt>)</span>
210
+
211
+
212
+
213
+ &mdash;
214
+ <div class='inline'>
215
+ <p>Data row cell.</p>
216
+ </div>
217
+
218
+ </li>
219
+
220
+ </ul>
221
+
222
+ <p class="tag_title">Returns:</p>
223
+ <ul class="return">
224
+
225
+ <li>
226
+
227
+
228
+ <span class='type'>(<tt>Boolean</tt>)</span>
229
+
230
+
231
+
232
+ </li>
233
+
234
+ <li>
235
+
236
+
237
+ <span class='type'>(<tt>false</tt>, <tt><span class='object_link'><a href="../CSVDecision.html#Proc-constant" title="CSVDecision::Proc (constant)">CSVDecision::Proc</a></span></tt>)</span>
238
+
239
+
240
+
241
+ &mdash;
242
+ <div class='inline'>
243
+ <p>Returns false if this cell is not a match; otherwise returns the
244
+ <code>CSVDecision::Proc</code> object indicating if this is a constant or
245
+ some type of function.</p>
246
+ </div>
247
+
248
+ </li>
249
+
250
+ </ul>
251
+
252
+ </div><table class="source_code">
253
+ <tr>
254
+ <td>
255
+ <pre class="lines">
256
+
257
+
258
+ 24
259
+ 25
260
+ 26
261
+ 27
262
+ 28
263
+ 29
264
+ 30
265
+ 31</pre>
266
+ </td>
267
+ <td>
268
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/constant.rb', line 24</span>
269
+
270
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
271
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#EXPRESSION-constant" title="CSVDecision::Constant::EXPRESSION (constant)">EXPRESSION</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='rparen'>)</span>
272
+
273
+ <span class='id identifier rubyid_proc'>proc</span> <span class='op'>=</span> <span class='id identifier rubyid_non_numeric?'>non_numeric?</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
274
+ <span class='kw'>return</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>if</span> <span class='id identifier rubyid_proc'>proc</span>
275
+
276
+ <span class='id identifier rubyid_numeric?'>numeric?</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
277
+ <span class='kw'>end</span></pre>
278
+ </td>
279
+ </tr>
280
+ </table>
281
+ </div>
282
+
283
+ </div>
284
+
285
+ </div>
286
+
287
+ <div id="footer">
288
+ Generated on Tue Dec 26 18:31:37 2017 by
289
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
290
+ 0.9.12 (ruby-2.3.0).
291
+ </div>
292
+
293
+ </div>
294
+ </body>
295
+ </html>
@@ -0,0 +1,344 @@
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::Data
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::Data";
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 (D)</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">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
+ </div>
61
+
62
+ <div id="content"><h1>Module: CSVDecision::Data
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/data.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Methods to load data from a file, CSV string or array of arrays</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+
97
+ </div>
98
+ <h2>Constant Summary</h2>
99
+ <dl class="constants">
100
+
101
+ <dt id="CSV_OPTIONS-constant" class="">CSV_OPTIONS =
102
+
103
+ </dt>
104
+ <dd><pre class="code"><span class='lbrace'>{</span> <span class='label'>encoding:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>skip_blanks:</span> <span class='kw'>true</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
105
+
106
+ </dl>
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <h2>
116
+ Class Method Summary
117
+ <small><a href="#" class="summary_toggle">collapse</a></small>
118
+ </h2>
119
+
120
+ <ul class="summary">
121
+
122
+ <li class="public ">
123
+ <span class="summary_signature">
124
+
125
+ <a href="#input_file%3F-class_method" title="input_file? (class method)">.<strong>input_file?</strong>(input) &#x21d2; Boolean </a>
126
+
127
+
128
+
129
+ </span>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ <span class="summary_desc"><div class='inline'></div></span>
140
+
141
+ </li>
142
+
143
+
144
+ <li class="public ">
145
+ <span class="summary_signature">
146
+
147
+ <a href="#strip_columns-class_method" title="strip_columns (class method)">.<strong>strip_columns</strong>(data:, empty_columns:) &#x21d2; Object </a>
148
+
149
+
150
+
151
+ </span>
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <span class="summary_desc"><div class='inline'></div></span>
162
+
163
+ </li>
164
+
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#to_array-class_method" title="to_array (class method)">.<strong>to_array</strong>(data:) &#x21d2; Object </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'>
184
+ <p>Parse the input data which may either be a file path name, CSV string or
185
+ array of arrays.</p>
186
+ </div></span>
187
+
188
+ </li>
189
+
190
+
191
+ </ul>
192
+
193
+
194
+
195
+
196
+ <div id="class_method_details" class="method_details_list">
197
+ <h2>Class Method Details</h2>
198
+
199
+
200
+ <div class="method_details first">
201
+ <h3 class="signature first" id="input_file?-class_method">
202
+
203
+ .<strong>input_file?</strong>(input) &#x21d2; <tt>Boolean</tt>
204
+
205
+
206
+
207
+
208
+
209
+ </h3><div class="docstring">
210
+ <div class="discussion">
211
+
212
+
213
+ </div>
214
+ </div>
215
+ <div class="tags">
216
+
217
+ <p class="tag_title">Returns:</p>
218
+ <ul class="return">
219
+
220
+ <li>
221
+
222
+
223
+ <span class='type'>(<tt>Boolean</tt>)</span>
224
+
225
+
226
+
227
+ </li>
228
+
229
+ </ul>
230
+
231
+ </div><table class="source_code">
232
+ <tr>
233
+ <td>
234
+ <pre class="lines">
235
+
236
+
237
+ 21
238
+ 22
239
+ 23</pre>
240
+ </td>
241
+ <td>
242
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 21</span>
243
+
244
+ <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_input'>input</span><span class='rparen'>)</span>
245
+ <span class='id identifier rubyid_input'>input</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_input'>input</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>
246
+ <span class='kw'>end</span></pre>
247
+ </td>
248
+ </tr>
249
+ </table>
250
+ </div>
251
+
252
+ <div class="method_details ">
253
+ <h3 class="signature " id="strip_columns-class_method">
254
+
255
+ .<strong>strip_columns</strong>(data:, empty_columns:) &#x21d2; <tt>Object</tt>
256
+
257
+
258
+
259
+
260
+
261
+ </h3><table class="source_code">
262
+ <tr>
263
+ <td>
264
+ <pre class="lines">
265
+
266
+
267
+ 25
268
+ 26
269
+ 27
270
+ 28
271
+ 29
272
+ 30
273
+ 31</pre>
274
+ </td>
275
+ <td>
276
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 25</span>
277
+
278
+ <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>
279
+ <span class='comment'># Adjust column indices as we delete columns the rest shift to the left by 1
280
+ </span> <span class='id identifier rubyid_empty_columns'>empty_columns</span><span class='period'>.</span><span class='id identifier rubyid_map!'>map!</span><span class='period'>.</span><span class='id identifier rubyid_with_index'>with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span> <span class='id identifier rubyid_col'>col</span> <span class='op'>-</span> <span class='id identifier rubyid_index'>index</span> <span class='rbrace'>}</span>
281
+
282
+ <span class='comment'># Delete all empty columns from the array of arrays
283
+ </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>
284
+ <span class='kw'>end</span></pre>
285
+ </td>
286
+ </tr>
287
+ </table>
288
+ </div>
289
+
290
+ <div class="method_details ">
291
+ <h3 class="signature " id="to_array-class_method">
292
+
293
+ .<strong>to_array</strong>(data:) &#x21d2; <tt>Object</tt>
294
+
295
+
296
+
297
+
298
+
299
+ </h3><div class="docstring">
300
+ <div class="discussion">
301
+
302
+ <p>Parse the input data which may either be a file path name, CSV string or
303
+ array of arrays. Strips out empty columns/rows and comment cells</p>
304
+
305
+
306
+ </div>
307
+ </div>
308
+ <div class="tags">
309
+
310
+
311
+ </div><table class="source_code">
312
+ <tr>
313
+ <td>
314
+ <pre class="lines">
315
+
316
+
317
+ 17
318
+ 18
319
+ 19</pre>
320
+ </td>
321
+ <td>
322
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/data.rb', line 17</span>
323
+
324
+ <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>
325
+ <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>
326
+ <span class='kw'>end</span></pre>
327
+ </td>
328
+ </tr>
329
+ </table>
330
+ </div>
331
+
332
+ </div>
333
+
334
+ </div>
335
+
336
+ <div id="footer">
337
+ Generated on Tue Dec 26 18:31:37 2017 by
338
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
339
+ 0.9.12 (ruby-2.3.0).
340
+ </div>
341
+
342
+ </div>
343
+ </body>
344
+ </html>