sycsvpro 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +20 -0
- data/README.md +188 -0
- data/README.rdoc +44 -0
- data/Rakefile +44 -0
- data/bin/sycsvpro +208 -0
- data/features/step_definitions/sycsvpro_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/features/sycsvpro.feature +8 -0
- data/html/Dsl.html +201 -0
- data/html/Object.html +116 -0
- data/html/README_rdoc.html +178 -0
- data/html/Sycsvpro/Analyzer.html +239 -0
- data/html/Sycsvpro/Calculator.html +354 -0
- data/html/Sycsvpro/Collector.html +281 -0
- data/html/Sycsvpro/ColumnFilter.html +165 -0
- data/html/Sycsvpro/Counter.html +397 -0
- data/html/Sycsvpro/Extractor.html +269 -0
- data/html/Sycsvpro/Filter.html +349 -0
- data/html/Sycsvpro/Header.html +228 -0
- data/html/Sycsvpro/Mapper.html +288 -0
- data/html/Sycsvpro/Profiler.html +234 -0
- data/html/Sycsvpro/RowFilter.html +162 -0
- data/html/Sycsvpro.html +141 -0
- data/html/created.rid +17 -0
- 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 +167 -0
- 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 +202 -0
- data/html/js/darkfish.js +140 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +580 -0
- data/html/table_of_contents.html +236 -0
- data/lib/sycsvpro/analyzer.rb +40 -0
- data/lib/sycsvpro/calculator.rb +94 -0
- data/lib/sycsvpro/collector.rb +60 -0
- data/lib/sycsvpro/column_filter.rb +23 -0
- data/lib/sycsvpro/counter.rb +74 -0
- data/lib/sycsvpro/dsl.rb +37 -0
- data/lib/sycsvpro/extractor.rb +39 -0
- data/lib/sycsvpro/filter.rb +98 -0
- data/lib/sycsvpro/header.rb +29 -0
- data/lib/sycsvpro/mapper.rb +53 -0
- data/lib/sycsvpro/profiler.rb +26 -0
- data/lib/sycsvpro/row_filter.rb +20 -0
- data/lib/sycsvpro/version.rb +5 -0
- data/lib/sycsvpro.rb +9 -0
- data/spec/sycsvpro/analyze_spec.rb +23 -0
- data/spec/sycsvpro/calculator_spec.rb +45 -0
- data/spec/sycsvpro/collector_spec.rb +27 -0
- data/spec/sycsvpro/counter_spec.rb +51 -0
- data/spec/sycsvpro/extractor_spec.rb +27 -0
- data/spec/sycsvpro/files/mappings +6 -0
- data/spec/sycsvpro/files/profile.rb +42 -0
- data/spec/sycsvpro/mapper_spec.rb +33 -0
- data/spec/sycsvpro/profiler_spec.rb +32 -0
- data/sycsvpro.gemspec +24 -0
- data/sycsvpro.rdoc +29 -0
- metadata +215 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>class Sycsvpro::Collector - 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::Collector">
|
|
87
|
+
<h1 id="class-Sycsvpro::Collector" class="class">
|
|
88
|
+
class Sycsvpro::Collector
|
|
89
|
+
</h1>
|
|
90
|
+
|
|
91
|
+
<section class="description">
|
|
92
|
+
|
|
93
|
+
<p>Collects values from rows and groups them in categories</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-collection" class="method-detail">
|
|
115
|
+
<div class="method-heading attribute-method-heading">
|
|
116
|
+
<span class="method-name">collection</span><span
|
|
117
|
+
class="attribute-access-type">[R]</span>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div class="method-description">
|
|
121
|
+
|
|
122
|
+
<p>collected values assigned to categories</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-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>outfile is the file where the result is written to</p>
|
|
149
|
+
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div id="attribute-i-row_filter" class="method-detail">
|
|
154
|
+
<div class="method-heading attribute-method-heading">
|
|
155
|
+
<span class="method-name">row_filter</span><span
|
|
156
|
+
class="attribute-access-type">[R]</span>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div class="method-description">
|
|
160
|
+
|
|
161
|
+
<p>filter that is used for 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 a new <a href="Collector.html">Collector</a></p>
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<div class="method-source-code" id="new-source">
|
|
195
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/collector.rb, line 20</span>
|
|
196
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
|
197
|
+
<span class="ruby-ivar">@infile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:infile</span>]
|
|
198
|
+
<span class="ruby-ivar">@outfile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:outfile</span>]
|
|
199
|
+
<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>])
|
|
200
|
+
<span class="ruby-ivar">@collection</span> = {}
|
|
201
|
+
<span class="ruby-identifier">init_collection</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:cols</span>])
|
|
202
|
+
<span class="ruby-keyword">end</span></pre>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
</section>
|
|
214
|
+
|
|
215
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
216
|
+
<header>
|
|
217
|
+
<h3>Public Instance Methods</h3>
|
|
218
|
+
</header>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<div id="method-i-execute" class="method-detail ">
|
|
222
|
+
|
|
223
|
+
<div class="method-heading">
|
|
224
|
+
<span class="method-name">execute</span><span
|
|
225
|
+
class="method-args">()</span>
|
|
226
|
+
|
|
227
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
228
|
+
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
<div class="method-description">
|
|
233
|
+
|
|
234
|
+
<p>Execute the collector</p>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<div class="method-source-code" id="execute-source">
|
|
240
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/collector.rb, line 29</span>
|
|
241
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
|
|
242
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">new</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>
|
|
243
|
+
<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>)
|
|
244
|
+
<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">chomp</span>.<span class="ruby-identifier">empty?</span>
|
|
245
|
+
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">category</span>, <span class="ruby-identifier">elements</span><span class="ruby-operator">|</span>
|
|
246
|
+
<span class="ruby-identifier">values</span> = <span class="ruby-identifier">elements</span>[<span class="ruby-value">:filter</span>].<span class="ruby-identifier">process</span>(<span class="ruby-identifier">row</span>)
|
|
247
|
+
<span class="ruby-identifier">values</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
|
248
|
+
<span class="ruby-identifier">elements</span>[<span class="ruby-value">:entries</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">chomp</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">elements</span>[<span class="ruby-value">:entries</span>].<span class="ruby-identifier">index</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">chomp</span>).<span class="ruby-identifier">nil?</span>
|
|
249
|
+
<span class="ruby-keyword">end</span>
|
|
250
|
+
<span class="ruby-keyword">end</span>
|
|
251
|
+
<span class="ruby-keyword">end</span>
|
|
252
|
+
|
|
253
|
+
<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>
|
|
254
|
+
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">category</span>, <span class="ruby-identifier">elements</span><span class="ruby-operator">|</span>
|
|
255
|
+
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"[#{category}]"</span>
|
|
256
|
+
<span class="ruby-identifier">elements</span>[<span class="ruby-value">:entries</span>].<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span> }
|
|
257
|
+
<span class="ruby-keyword">end</span>
|
|
258
|
+
<span class="ruby-keyword">end</span>
|
|
259
|
+
<span class="ruby-keyword">end</span></pre>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
</section>
|
|
271
|
+
|
|
272
|
+
</section>
|
|
273
|
+
</main>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
<footer id="validator-badges" role="contentinfo">
|
|
277
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
278
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
279
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
280
|
+
</footer>
|
|
281
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>class Sycsvpro::ColumnFilter - 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">Filter
|
|
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-i-process">#process</a>
|
|
77
|
+
|
|
78
|
+
</ul>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
</nav>
|
|
83
|
+
|
|
84
|
+
<main role="main" aria-labelledby="class-Sycsvpro::ColumnFilter">
|
|
85
|
+
<h1 id="class-Sycsvpro::ColumnFilter" class="class">
|
|
86
|
+
class Sycsvpro::ColumnFilter
|
|
87
|
+
</h1>
|
|
88
|
+
|
|
89
|
+
<section class="description">
|
|
90
|
+
|
|
91
|
+
<p>Creates a new column filter</p>
|
|
92
|
+
|
|
93
|
+
</section>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
109
|
+
<header>
|
|
110
|
+
<h3>Public Instance Methods</h3>
|
|
111
|
+
</header>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<div id="method-i-process" class="method-detail ">
|
|
115
|
+
|
|
116
|
+
<div class="method-heading">
|
|
117
|
+
<span class="method-name">process</span><span
|
|
118
|
+
class="method-args">(object, options={})</span>
|
|
119
|
+
|
|
120
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
121
|
+
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
<div class="method-description">
|
|
126
|
+
|
|
127
|
+
<p>Processes the filter and returns the values that respect the filter</p>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<div class="method-source-code" id="process-source">
|
|
133
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/column_filter.rb, line 10</span>
|
|
134
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">options</span>={})
|
|
135
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">empty?</span>
|
|
136
|
+
<span class="ruby-identifier">object</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-string">'UTF-8'</span>, <span class="ruby-string">'binary'</span>, <span class="ruby-identifier">invalid</span><span class="ruby-operator">:</span> <span class="ruby-value">:replace</span>, <span class="ruby-keyword">undef</span><span class="ruby-operator">:</span> <span class="ruby-value">:replace</span>, <span class="ruby-identifier">replace</span><span class="ruby-operator">:</span> <span class="ruby-string">''</span>)
|
|
137
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">object</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">pivot</span>.<span class="ruby-identifier">empty?</span>
|
|
138
|
+
<span class="ruby-identifier">filtered</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>).<span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">filter</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>)
|
|
139
|
+
<span class="ruby-identifier">pivot_each_column</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>)) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span>, <span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
|
|
140
|
+
<span class="ruby-identifier">filtered</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">column</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>
|
|
141
|
+
<span class="ruby-keyword">end</span>
|
|
142
|
+
<span class="ruby-identifier">filtered</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">';'</span>)
|
|
143
|
+
<span class="ruby-keyword">end</span></pre>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
</section>
|
|
155
|
+
|
|
156
|
+
</section>
|
|
157
|
+
</main>
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
<footer id="validator-badges" role="contentinfo">
|
|
161
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
162
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
|
163
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
164
|
+
</footer>
|
|
165
|
+
|