sycsvpro 0.1.2 → 0.1.3
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.
- data/Gemfile.lock +3 -1
- data/README.md +21 -8
- data/README.rdoc +3 -2
- data/bin/sycsvpro +17 -6
- data/lib/sycsvpro/aggregator.rb +16 -5
- data/lib/sycsvpro/calculator.rb +19 -5
- data/lib/sycsvpro/counter.rb +17 -7
- data/lib/sycsvpro/dsl.rb +43 -0
- data/lib/sycsvpro/filter.rb +0 -7
- data/lib/sycsvpro/sorter.rb +28 -8
- data/lib/sycsvpro/version.rb +1 -1
- data/spec/sycsvpro/sorter_spec.rb +50 -0
- data/sycsvpro.gemspec +1 -0
- metadata +18 -66
- data/html/Dsl.html +0 -277
- data/html/Object.html +0 -187
- data/html/README_rdoc.html +0 -187
- data/html/Sycsvpro/Aggregator.html +0 -482
- data/html/Sycsvpro/Allocator.html +0 -293
- data/html/Sycsvpro/Analyzer.html +0 -239
- data/html/Sycsvpro/Calculator.html +0 -407
- data/html/Sycsvpro/Collector.html +0 -281
- data/html/Sycsvpro/ColumnFilter.html +0 -170
- data/html/Sycsvpro/ColumnTypeFilter.html +0 -191
- data/html/Sycsvpro/Counter.html +0 -492
- data/html/Sycsvpro/Extractor.html +0 -269
- data/html/Sycsvpro/Filter.html +0 -411
- data/html/Sycsvpro/Header.html +0 -239
- data/html/Sycsvpro/Inserter.html +0 -275
- data/html/Sycsvpro/Mapper.html +0 -288
- data/html/Sycsvpro/Profiler.html +0 -234
- data/html/Sycsvpro/RowFilter.html +0 -175
- data/html/Sycsvpro/ScriptCreator.html +0 -235
- data/html/Sycsvpro/ScriptList.html +0 -281
- data/html/Sycsvpro/Sorter.html +0 -346
- data/html/Sycsvpro.html +0 -155
- data/html/created.rid +0 -24
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/fonts.css +0 -167
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +0 -225
- data/html/js/darkfish.js +0 -140
- data/html/js/jquery.js +0 -18
- data/html/js/navigation.js +0 -142
- data/html/js/search.js +0 -109
- data/html/js/search_index.js +0 -1
- data/html/js/searcher.js +0 -228
- data/html/rdoc.css +0 -580
- data/html/table_of_contents.html +0 -347
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class Sycsvpro::Allocator - Your application title</title>
|
|
8
|
-
|
|
9
|
-
<link href="../fonts.css" rel="stylesheet">
|
|
10
|
-
<link href="../rdoc.css" rel="stylesheet">
|
|
11
|
-
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
var rdoc_rel_prefix = "../";
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<script src="../js/jquery.js"></script>
|
|
17
|
-
<script src="../js/navigation.js"></script>
|
|
18
|
-
<script src="../js/search_index.js"></script>
|
|
19
|
-
<script src="../js/search.js"></script>
|
|
20
|
-
<script src="../js/searcher.js"></script>
|
|
21
|
-
<script src="../js/darkfish.js"></script>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<body id="top" role="document" class="class">
|
|
25
|
-
<nav role="navigation">
|
|
26
|
-
<div id="project-navigation">
|
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
-
<h2>
|
|
29
|
-
<a href="../index.html" rel="home">Home</a>
|
|
30
|
-
</h2>
|
|
31
|
-
|
|
32
|
-
<div id="table-of-contents-navigation">
|
|
33
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
|
34
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
|
35
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
-
<div id="search-field-wrapper">
|
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
|
49
|
-
aria-busy="false" aria-expanded="false"
|
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
-
</form>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<div id="class-metadata">
|
|
59
|
-
|
|
60
|
-
<div id="parent-class-section" class="nav-section">
|
|
61
|
-
<h3>Parent</h3>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<p class="link"><a href="../Object.html">Object</a>
|
|
65
|
-
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<!-- Method Quickref -->
|
|
71
|
-
<div id="method-list-section" class="nav-section">
|
|
72
|
-
<h3>Methods</h3>
|
|
73
|
-
|
|
74
|
-
<ul class="link-list" role="directory">
|
|
75
|
-
|
|
76
|
-
<li ><a href="#method-c-new">::new</a>
|
|
77
|
-
|
|
78
|
-
<li ><a href="#method-i-execute">#execute</a>
|
|
79
|
-
|
|
80
|
-
</ul>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
</div>
|
|
84
|
-
</nav>
|
|
85
|
-
|
|
86
|
-
<main role="main" aria-labelledby="class-Sycsvpro::Allocator">
|
|
87
|
-
<h1 id="class-Sycsvpro::Allocator" class="class">
|
|
88
|
-
class Sycsvpro::Allocator
|
|
89
|
-
</h1>
|
|
90
|
-
|
|
91
|
-
<section class="description">
|
|
92
|
-
|
|
93
|
-
<p>Allocates columns to a key column</p>
|
|
94
|
-
|
|
95
|
-
</section>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<section class="attribute-method-details" class="method-section">
|
|
109
|
-
<header>
|
|
110
|
-
<h3>Attributes</h3>
|
|
111
|
-
</header>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<div id="attribute-i-col_filter" class="method-detail">
|
|
115
|
-
<div class="method-heading attribute-method-heading">
|
|
116
|
-
<span class="method-name">col_filter</span><span
|
|
117
|
-
class="attribute-access-type">[R]</span>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div class="method-description">
|
|
121
|
-
|
|
122
|
-
<p><a href="Filter.html">Filter</a> for columns to allocate</p>
|
|
123
|
-
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div id="attribute-i-infile" class="method-detail">
|
|
128
|
-
<div class="method-heading attribute-method-heading">
|
|
129
|
-
<span class="method-name">infile</span><span
|
|
130
|
-
class="attribute-access-type">[R]</span>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<div class="method-description">
|
|
134
|
-
|
|
135
|
-
<p>File from that values are read</p>
|
|
136
|
-
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div id="attribute-i-key_filter" class="method-detail">
|
|
141
|
-
<div class="method-heading attribute-method-heading">
|
|
142
|
-
<span class="method-name">key_filter</span><span
|
|
143
|
-
class="attribute-access-type">[R]</span>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<div class="method-description">
|
|
147
|
-
|
|
148
|
-
<p><a href="Filter.html">Filter</a> for the key column that the values are
|
|
149
|
-
allocated at</p>
|
|
150
|
-
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
|
|
154
|
-
<div id="attribute-i-outfile" class="method-detail">
|
|
155
|
-
<div class="method-heading attribute-method-heading">
|
|
156
|
-
<span class="method-name">outfile</span><span
|
|
157
|
-
class="attribute-access-type">[R]</span>
|
|
158
|
-
</div>
|
|
159
|
-
|
|
160
|
-
<div class="method-description">
|
|
161
|
-
|
|
162
|
-
<p>File to that result of allocation is written</p>
|
|
163
|
-
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<div id="attribute-i-row_filter" class="method-detail">
|
|
168
|
-
<div class="method-heading attribute-method-heading">
|
|
169
|
-
<span class="method-name">row_filter</span><span
|
|
170
|
-
class="attribute-access-type">[R]</span>
|
|
171
|
-
</div>
|
|
172
|
-
|
|
173
|
-
<div class="method-description">
|
|
174
|
-
|
|
175
|
-
<p><a href="Filter.html">Filter</a> for rows to consider</p>
|
|
176
|
-
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
</section>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
185
|
-
<header>
|
|
186
|
-
<h3>Public Class Methods</h3>
|
|
187
|
-
</header>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
<div id="method-c-new" class="method-detail ">
|
|
191
|
-
|
|
192
|
-
<div class="method-heading">
|
|
193
|
-
<span class="method-name">new</span><span
|
|
194
|
-
class="method-args">(options={})</span>
|
|
195
|
-
|
|
196
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
197
|
-
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<div class="method-description">
|
|
202
|
-
|
|
203
|
-
<p>Creates a new allocator. Options are infile, outfile, key, rows and columns
|
|
204
|
-
to allocate to key</p>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
<div class="method-source-code" id="new-source">
|
|
210
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/allocator.rb, line 19</span>
|
|
211
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
|
212
|
-
<span class="ruby-ivar">@infile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:infile</span>]
|
|
213
|
-
<span class="ruby-ivar">@outfile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:outfile</span>]
|
|
214
|
-
<span class="ruby-ivar">@key_filter</span> = <span class="ruby-constant">ColumnFilter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:key</span>])
|
|
215
|
-
<span class="ruby-ivar">@row_filter</span> = <span class="ruby-constant">RowFilter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:rows</span>])
|
|
216
|
-
<span class="ruby-ivar">@col_filter</span> = <span class="ruby-constant">ColumnFilter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:cols</span>])
|
|
217
|
-
<span class="ruby-keyword">end</span></pre>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
</section>
|
|
229
|
-
|
|
230
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
231
|
-
<header>
|
|
232
|
-
<h3>Public Instance Methods</h3>
|
|
233
|
-
</header>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<div id="method-i-execute" class="method-detail ">
|
|
237
|
-
|
|
238
|
-
<div class="method-heading">
|
|
239
|
-
<span class="method-name">execute</span><span
|
|
240
|
-
class="method-args">()</span>
|
|
241
|
-
|
|
242
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
243
|
-
|
|
244
|
-
</div>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
<div class="method-description">
|
|
248
|
-
|
|
249
|
-
<p>Executes the allocator and assigns column values to the key</p>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
<div class="method-source-code" id="execute-source">
|
|
255
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/allocator.rb, line 28</span>
|
|
256
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
|
|
257
|
-
<span class="ruby-identifier">allocation</span> = {}
|
|
258
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">infile</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
|
259
|
-
<span class="ruby-identifier">row</span> = <span class="ruby-identifier">row_filter</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">line</span>, <span class="ruby-identifier">row</span><span class="ruby-operator">:</span> <span class="ruby-identifier">index</span>)
|
|
260
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">empty?</span>
|
|
261
|
-
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">key_filter</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">row</span>)
|
|
262
|
-
<span class="ruby-identifier">allocation</span>[<span class="ruby-identifier">key</span>] = [] <span class="ruby-keyword">if</span> <span class="ruby-identifier">allocation</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">nil?</span>
|
|
263
|
-
<span class="ruby-identifier">allocation</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">col_filter</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">row</span>).<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>)
|
|
264
|
-
<span class="ruby-keyword">end</span>
|
|
265
|
-
|
|
266
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">outfile</span>, <span class="ruby-string">'w'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
|
|
267
|
-
<span class="ruby-identifier">allocation</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span>
|
|
268
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{key};#{values.flatten.uniq.sort.join(';')}"</span>
|
|
269
|
-
<span class="ruby-keyword">end</span>
|
|
270
|
-
<span class="ruby-keyword">end</span>
|
|
271
|
-
<span class="ruby-keyword">end</span></pre>
|
|
272
|
-
</div>
|
|
273
|
-
|
|
274
|
-
</div>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
</section>
|
|
283
|
-
|
|
284
|
-
</section>
|
|
285
|
-
</main>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<footer id="validator-badges" role="contentinfo">
|
|
289
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
290
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
291
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
292
|
-
</footer>
|
|
293
|
-
|
data/html/Sycsvpro/Analyzer.html
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class Sycsvpro::Analyzer - Your application title</title>
|
|
8
|
-
|
|
9
|
-
<link href="../fonts.css" rel="stylesheet">
|
|
10
|
-
<link href="../rdoc.css" rel="stylesheet">
|
|
11
|
-
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
var rdoc_rel_prefix = "../";
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<script src="../js/jquery.js"></script>
|
|
17
|
-
<script src="../js/navigation.js"></script>
|
|
18
|
-
<script src="../js/search_index.js"></script>
|
|
19
|
-
<script src="../js/search.js"></script>
|
|
20
|
-
<script src="../js/searcher.js"></script>
|
|
21
|
-
<script src="../js/darkfish.js"></script>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<body id="top" role="document" class="class">
|
|
25
|
-
<nav role="navigation">
|
|
26
|
-
<div id="project-navigation">
|
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
-
<h2>
|
|
29
|
-
<a href="../index.html" rel="home">Home</a>
|
|
30
|
-
</h2>
|
|
31
|
-
|
|
32
|
-
<div id="table-of-contents-navigation">
|
|
33
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
|
34
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
|
35
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
-
<div id="search-field-wrapper">
|
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
|
49
|
-
aria-busy="false" aria-expanded="false"
|
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
-
</form>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<div id="class-metadata">
|
|
59
|
-
|
|
60
|
-
<div id="parent-class-section" class="nav-section">
|
|
61
|
-
<h3>Parent</h3>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<p class="link"><a href="../Object.html">Object</a>
|
|
65
|
-
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<!-- Method Quickref -->
|
|
71
|
-
<div id="method-list-section" class="nav-section">
|
|
72
|
-
<h3>Methods</h3>
|
|
73
|
-
|
|
74
|
-
<ul class="link-list" role="directory">
|
|
75
|
-
|
|
76
|
-
<li ><a href="#method-c-new">::new</a>
|
|
77
|
-
|
|
78
|
-
<li ><a href="#method-i-result">#result</a>
|
|
79
|
-
|
|
80
|
-
</ul>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
</div>
|
|
84
|
-
</nav>
|
|
85
|
-
|
|
86
|
-
<main role="main" aria-labelledby="class-Sycsvpro::Analyzer">
|
|
87
|
-
<h1 id="class-Sycsvpro::Analyzer" class="class">
|
|
88
|
-
class Sycsvpro::Analyzer
|
|
89
|
-
</h1>
|
|
90
|
-
|
|
91
|
-
<section class="description">
|
|
92
|
-
|
|
93
|
-
<p>Analyzes the file structure</p>
|
|
94
|
-
|
|
95
|
-
</section>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<section class="attribute-method-details" class="method-section">
|
|
109
|
-
<header>
|
|
110
|
-
<h3>Attributes</h3>
|
|
111
|
-
</header>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<div id="attribute-i-file" class="method-detail">
|
|
115
|
-
<div class="method-heading attribute-method-heading">
|
|
116
|
-
<span class="method-name">file</span><span
|
|
117
|
-
class="attribute-access-type">[R]</span>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div class="method-description">
|
|
121
|
-
|
|
122
|
-
<p>File that is analyzed</p>
|
|
123
|
-
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
</section>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
132
|
-
<header>
|
|
133
|
-
<h3>Public Class Methods</h3>
|
|
134
|
-
</header>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<div id="method-c-new" class="method-detail ">
|
|
138
|
-
|
|
139
|
-
<div class="method-heading">
|
|
140
|
-
<span class="method-name">new</span><span
|
|
141
|
-
class="method-args">(file)</span>
|
|
142
|
-
|
|
143
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
144
|
-
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<div class="method-description">
|
|
149
|
-
|
|
150
|
-
<p>Creates a new analyzer</p>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<div class="method-source-code" id="new-source">
|
|
156
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/analyzer.rb, line 14</span>
|
|
157
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file</span>)
|
|
158
|
-
<span class="ruby-ivar">@file</span> = <span class="ruby-identifier">file</span>
|
|
159
|
-
<span class="ruby-keyword">end</span></pre>
|
|
160
|
-
</div>
|
|
161
|
-
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</section>
|
|
171
|
-
|
|
172
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
173
|
-
<header>
|
|
174
|
-
<h3>Public Instance Methods</h3>
|
|
175
|
-
</header>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<div id="method-i-result" class="method-detail ">
|
|
179
|
-
|
|
180
|
-
<div class="method-heading">
|
|
181
|
-
<span class="method-name">result</span><span
|
|
182
|
-
class="method-args">()</span>
|
|
183
|
-
|
|
184
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
185
|
-
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<div class="method-description">
|
|
190
|
-
|
|
191
|
-
<p>Analyzes the file and returns the result</p>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<div class="method-source-code" id="result-source">
|
|
197
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/analyzer.rb, line 19</span>
|
|
198
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">result</span>
|
|
199
|
-
<span class="ruby-identifier">rows</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">file</span>)
|
|
200
|
-
|
|
201
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-constant">Result</span>.<span class="ruby-identifier">new</span>
|
|
202
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">rows</span>.<span class="ruby-identifier">empty?</span>
|
|
203
|
-
<span class="ruby-identifier">row_number</span> = <span class="ruby-value">0</span>
|
|
204
|
-
<span class="ruby-identifier">row_number</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_number</span>].<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">empty?</span>
|
|
205
|
-
|
|
206
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">cols</span> = <span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_number</span>].<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>)
|
|
207
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">col_count</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">cols</span>.<span class="ruby-identifier">size</span>
|
|
208
|
-
|
|
209
|
-
<span class="ruby-identifier">row_number</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
|
210
|
-
<span class="ruby-identifier">row_number</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_number</span>].<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">empty?</span>
|
|
211
|
-
|
|
212
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">row_count</span> = <span class="ruby-identifier">rows</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
|
213
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">sample_row</span> = <span class="ruby-identifier">rows</span>[<span class="ruby-identifier">row_number</span>].<span class="ruby-identifier">chomp</span>
|
|
214
|
-
<span class="ruby-keyword">end</span>
|
|
215
|
-
|
|
216
|
-
<span class="ruby-identifier">result</span>
|
|
217
|
-
<span class="ruby-keyword">end</span></pre>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
</section>
|
|
229
|
-
|
|
230
|
-
</section>
|
|
231
|
-
</main>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<footer id="validator-badges" role="contentinfo">
|
|
235
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
236
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
237
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
238
|
-
</footer>
|
|
239
|
-
|