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
data/html/Sycsvpro/Inserter.html
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class Sycsvpro::Inserter - 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::Inserter">
|
|
87
|
-
<h1 id="class-Sycsvpro::Inserter" class="class">
|
|
88
|
-
class Sycsvpro::Inserter
|
|
89
|
-
</h1>
|
|
90
|
-
|
|
91
|
-
<section class="description">
|
|
92
|
-
|
|
93
|
-
<p>Insert a text file into another textfile at a specified position</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-infile" class="method-detail">
|
|
115
|
-
<div class="method-heading attribute-method-heading">
|
|
116
|
-
<span class="method-name">infile</span><span
|
|
117
|
-
class="attribute-access-type">[R]</span>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div class="method-description">
|
|
121
|
-
|
|
122
|
-
<p>file to insert lines to</p>
|
|
123
|
-
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div id="attribute-i-insert" class="method-detail">
|
|
128
|
-
<div class="method-heading attribute-method-heading">
|
|
129
|
-
<span class="method-name">insert</span><span
|
|
130
|
-
class="attribute-access-type">[R]</span>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<div class="method-description">
|
|
134
|
-
|
|
135
|
-
<p>file that contains the lines to insert</p>
|
|
136
|
-
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div id="attribute-i-outfile" class="method-detail">
|
|
141
|
-
<div class="method-heading attribute-method-heading">
|
|
142
|
-
<span class="method-name">outfile</span><span
|
|
143
|
-
class="attribute-access-type">[R]</span>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<div class="method-description">
|
|
147
|
-
|
|
148
|
-
<p>file to write result to</p>
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div id="attribute-i-position" class="method-detail">
|
|
154
|
-
<div class="method-heading attribute-method-heading">
|
|
155
|
-
<span class="method-name">position</span><span
|
|
156
|
-
class="attribute-access-type">[R]</span>
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
<div class="method-description">
|
|
160
|
-
|
|
161
|
-
<p>position (top or bottom) where to insert the rows</p>
|
|
162
|
-
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
</section>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
171
|
-
<header>
|
|
172
|
-
<h3>Public Class Methods</h3>
|
|
173
|
-
</header>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<div id="method-c-new" class="method-detail ">
|
|
177
|
-
|
|
178
|
-
<div class="method-heading">
|
|
179
|
-
<span class="method-name">new</span><span
|
|
180
|
-
class="method-args">(options={})</span>
|
|
181
|
-
|
|
182
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
183
|
-
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<div class="method-description">
|
|
188
|
-
|
|
189
|
-
<p>Creates an <a href="Inserter.html">Inserter</a> and takes options infile,
|
|
190
|
-
outfile, insert-file and position where to insert the insert-file content.
|
|
191
|
-
Default position is top</p>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<div class="method-source-code" id="new-source">
|
|
197
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/inserter.rb, line 18</span>
|
|
198
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
|
199
|
-
<span class="ruby-ivar">@infile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:infile</span>]
|
|
200
|
-
<span class="ruby-ivar">@outfile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:outfile</span>]
|
|
201
|
-
<span class="ruby-ivar">@insert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:insert</span>]
|
|
202
|
-
<span class="ruby-ivar">@position</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:position</span>] <span class="ruby-operator">||</span> <span class="ruby-string">'top'</span>
|
|
203
|
-
<span class="ruby-keyword">end</span></pre>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
</div>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
</div>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
</section>
|
|
215
|
-
|
|
216
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
217
|
-
<header>
|
|
218
|
-
<h3>Public Instance Methods</h3>
|
|
219
|
-
</header>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
<div id="method-i-execute" class="method-detail ">
|
|
223
|
-
|
|
224
|
-
<div class="method-heading">
|
|
225
|
-
<span class="method-name">execute</span><span
|
|
226
|
-
class="method-args">()</span>
|
|
227
|
-
|
|
228
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
229
|
-
|
|
230
|
-
</div>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<div class="method-description">
|
|
234
|
-
|
|
235
|
-
<p>Inserts the content of the insert-file at the specified positions (top or
|
|
236
|
-
bottom)</p>
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<div class="method-source-code" id="execute-source">
|
|
242
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/inserter.rb, line 26</span>
|
|
243
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
|
|
244
|
-
<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>
|
|
245
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">position</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-string">'bottom'</span>
|
|
246
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">infile</span>)
|
|
247
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">insert</span>)
|
|
248
|
-
<span class="ruby-keyword">else</span>
|
|
249
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">insert</span>)
|
|
250
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">infile</span>)
|
|
251
|
-
<span class="ruby-keyword">end</span>
|
|
252
|
-
<span class="ruby-keyword">end</span>
|
|
253
|
-
<span class="ruby-keyword">end</span></pre>
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
</section>
|
|
265
|
-
|
|
266
|
-
</section>
|
|
267
|
-
</main>
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
<footer id="validator-badges" role="contentinfo">
|
|
271
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
272
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
273
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
274
|
-
</footer>
|
|
275
|
-
|
data/html/Sycsvpro/Mapper.html
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class Sycsvpro::Mapper - 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::Mapper">
|
|
87
|
-
<h1 id="class-Sycsvpro::Mapper" class="class">
|
|
88
|
-
class Sycsvpro::Mapper
|
|
89
|
-
</h1>
|
|
90
|
-
|
|
91
|
-
<section class="description">
|
|
92
|
-
|
|
93
|
-
<p>Map values to new values described in a mapping file</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>filter that is used for columns</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>infile contains the data that is operated on</p>
|
|
136
|
-
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div id="attribute-i-mapper" class="method-detail">
|
|
141
|
-
<div class="method-heading attribute-method-heading">
|
|
142
|
-
<span class="method-name">mapper</span><span
|
|
143
|
-
class="attribute-access-type">[R]</span>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<div class="method-description">
|
|
147
|
-
|
|
148
|
-
<p>file that contains the mappings from existing column values to new values</p>
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div id="attribute-i-outfile" class="method-detail">
|
|
154
|
-
<div class="method-heading attribute-method-heading">
|
|
155
|
-
<span class="method-name">outfile</span><span
|
|
156
|
-
class="attribute-access-type">[R]</span>
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
<div class="method-description">
|
|
160
|
-
|
|
161
|
-
<p>outfile is the file where the result is written to</p>
|
|
162
|
-
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
<div id="attribute-i-row_filter" class="method-detail">
|
|
167
|
-
<div class="method-heading attribute-method-heading">
|
|
168
|
-
<span class="method-name">row_filter</span><span
|
|
169
|
-
class="attribute-access-type">[R]</span>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
<div class="method-description">
|
|
173
|
-
|
|
174
|
-
<p>filter that is used for rows</p>
|
|
175
|
-
|
|
176
|
-
</div>
|
|
177
|
-
</div>
|
|
178
|
-
|
|
179
|
-
</section>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
184
|
-
<header>
|
|
185
|
-
<h3>Public Class Methods</h3>
|
|
186
|
-
</header>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<div id="method-c-new" class="method-detail ">
|
|
190
|
-
|
|
191
|
-
<div class="method-heading">
|
|
192
|
-
<span class="method-name">new</span><span
|
|
193
|
-
class="method-args">(options={})</span>
|
|
194
|
-
|
|
195
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
196
|
-
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<div class="method-description">
|
|
201
|
-
|
|
202
|
-
<p>Creates new mapper</p>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<div class="method-source-code" id="new-source">
|
|
208
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/mapper.rb, line 19</span>
|
|
209
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
|
210
|
-
<span class="ruby-ivar">@infile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:infile</span>]
|
|
211
|
-
<span class="ruby-ivar">@outfile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:outfile</span>]
|
|
212
|
-
<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">:row_filter</span>])
|
|
213
|
-
<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">:col_filter</span>])
|
|
214
|
-
<span class="ruby-ivar">@mapper</span> = {}
|
|
215
|
-
<span class="ruby-identifier">init_mapper</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:mapping</span>])
|
|
216
|
-
<span class="ruby-keyword">end</span></pre>
|
|
217
|
-
</div>
|
|
218
|
-
|
|
219
|
-
</div>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
</div>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
</section>
|
|
228
|
-
|
|
229
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
230
|
-
<header>
|
|
231
|
-
<h3>Public Instance Methods</h3>
|
|
232
|
-
</header>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
<div id="method-i-execute" class="method-detail ">
|
|
236
|
-
|
|
237
|
-
<div class="method-heading">
|
|
238
|
-
<span class="method-name">execute</span><span
|
|
239
|
-
class="method-args">()</span>
|
|
240
|
-
|
|
241
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
242
|
-
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
<div class="method-description">
|
|
247
|
-
|
|
248
|
-
<p>Executes the mapper</p>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
<div class="method-source-code" id="execute-source">
|
|
254
|
-
<pre><span class="ruby-comment"># File lib/sycsvpro/mapper.rb, line 29</span>
|
|
255
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
|
|
256
|
-
<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>
|
|
257
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">infile</span>, <span class="ruby-string">'r'</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>
|
|
258
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">col_filter</span>.<span class="ruby-identifier">process</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>))
|
|
259
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
|
|
260
|
-
<span class="ruby-identifier">mapper</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">|</span>
|
|
261
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/(?<=^|;)#{from}(?=;|$)/</span>, <span class="ruby-identifier">to</span>)
|
|
262
|
-
<span class="ruby-keyword">end</span>
|
|
263
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>
|
|
264
|
-
<span class="ruby-keyword">end</span>
|
|
265
|
-
<span class="ruby-keyword">end</span>
|
|
266
|
-
<span class="ruby-keyword">end</span></pre>
|
|
267
|
-
</div>
|
|
268
|
-
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
</div>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
</section>
|
|
278
|
-
|
|
279
|
-
</section>
|
|
280
|
-
</main>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<footer id="validator-badges" role="contentinfo">
|
|
284
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
285
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
286
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
287
|
-
</footer>
|
|
288
|
-
|