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.
Files changed (78) hide show
  1. data/Gemfile.lock +3 -1
  2. data/README.md +21 -8
  3. data/README.rdoc +3 -2
  4. data/bin/sycsvpro +17 -6
  5. data/lib/sycsvpro/aggregator.rb +16 -5
  6. data/lib/sycsvpro/calculator.rb +19 -5
  7. data/lib/sycsvpro/counter.rb +17 -7
  8. data/lib/sycsvpro/dsl.rb +43 -0
  9. data/lib/sycsvpro/filter.rb +0 -7
  10. data/lib/sycsvpro/sorter.rb +28 -8
  11. data/lib/sycsvpro/version.rb +1 -1
  12. data/spec/sycsvpro/sorter_spec.rb +50 -0
  13. data/sycsvpro.gemspec +1 -0
  14. metadata +18 -66
  15. data/html/Dsl.html +0 -277
  16. data/html/Object.html +0 -187
  17. data/html/README_rdoc.html +0 -187
  18. data/html/Sycsvpro/Aggregator.html +0 -482
  19. data/html/Sycsvpro/Allocator.html +0 -293
  20. data/html/Sycsvpro/Analyzer.html +0 -239
  21. data/html/Sycsvpro/Calculator.html +0 -407
  22. data/html/Sycsvpro/Collector.html +0 -281
  23. data/html/Sycsvpro/ColumnFilter.html +0 -170
  24. data/html/Sycsvpro/ColumnTypeFilter.html +0 -191
  25. data/html/Sycsvpro/Counter.html +0 -492
  26. data/html/Sycsvpro/Extractor.html +0 -269
  27. data/html/Sycsvpro/Filter.html +0 -411
  28. data/html/Sycsvpro/Header.html +0 -239
  29. data/html/Sycsvpro/Inserter.html +0 -275
  30. data/html/Sycsvpro/Mapper.html +0 -288
  31. data/html/Sycsvpro/Profiler.html +0 -234
  32. data/html/Sycsvpro/RowFilter.html +0 -175
  33. data/html/Sycsvpro/ScriptCreator.html +0 -235
  34. data/html/Sycsvpro/ScriptList.html +0 -281
  35. data/html/Sycsvpro/Sorter.html +0 -346
  36. data/html/Sycsvpro.html +0 -155
  37. data/html/created.rid +0 -24
  38. data/html/fonts/Lato-Light.ttf +0 -0
  39. data/html/fonts/Lato-LightItalic.ttf +0 -0
  40. data/html/fonts/Lato-Regular.ttf +0 -0
  41. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  42. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  43. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  44. data/html/fonts.css +0 -167
  45. data/html/images/add.png +0 -0
  46. data/html/images/arrow_up.png +0 -0
  47. data/html/images/brick.png +0 -0
  48. data/html/images/brick_link.png +0 -0
  49. data/html/images/bug.png +0 -0
  50. data/html/images/bullet_black.png +0 -0
  51. data/html/images/bullet_toggle_minus.png +0 -0
  52. data/html/images/bullet_toggle_plus.png +0 -0
  53. data/html/images/date.png +0 -0
  54. data/html/images/delete.png +0 -0
  55. data/html/images/find.png +0 -0
  56. data/html/images/loadingAnimation.gif +0 -0
  57. data/html/images/macFFBgHack.png +0 -0
  58. data/html/images/package.png +0 -0
  59. data/html/images/page_green.png +0 -0
  60. data/html/images/page_white_text.png +0 -0
  61. data/html/images/page_white_width.png +0 -0
  62. data/html/images/plugin.png +0 -0
  63. data/html/images/ruby.png +0 -0
  64. data/html/images/tag_blue.png +0 -0
  65. data/html/images/tag_green.png +0 -0
  66. data/html/images/transparent.png +0 -0
  67. data/html/images/wrench.png +0 -0
  68. data/html/images/wrench_orange.png +0 -0
  69. data/html/images/zoom.png +0 -0
  70. data/html/index.html +0 -225
  71. data/html/js/darkfish.js +0 -140
  72. data/html/js/jquery.js +0 -18
  73. data/html/js/navigation.js +0 -142
  74. data/html/js/search.js +0 -109
  75. data/html/js/search_index.js +0 -1
  76. data/html/js/searcher.js +0 -228
  77. data/html/rdoc.css +0 -580
  78. data/html/table_of_contents.html +0 -347
@@ -1,407 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class Sycsvpro::Calculator - 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
- <div id="includes-section" class="nav-section">
69
- <h3>Included Modules</h3>
70
-
71
- <ul class="link-list">
72
-
73
-
74
- <li><a class="include" href="../Dsl.html">Dsl</a>
75
-
76
-
77
- </ul>
78
- </div>
79
-
80
-
81
- <!-- Method Quickref -->
82
- <div id="method-list-section" class="nav-section">
83
- <h3>Methods</h3>
84
-
85
- <ul class="link-list" role="directory">
86
-
87
- <li ><a href="#method-c-new">::new</a>
88
-
89
- <li ><a href="#method-i-execute">#execute</a>
90
-
91
- <li ><a href="#method-i-method_missing">#method_missing</a>
92
-
93
- </ul>
94
- </div>
95
-
96
- </div>
97
- </nav>
98
-
99
- <main role="main" aria-labelledby="class-Sycsvpro::Calculator">
100
- <h1 id="class-Sycsvpro::Calculator" class="class">
101
- class Sycsvpro::Calculator
102
- </h1>
103
-
104
- <section class="description">
105
-
106
- <p>Processes arithmetic operations on columns of a csv file. A column value
107
- has to be a number. Possible operations are +, -, * and /. It is also
108
- possible to use values of columns as an operator like c1*2 will multiply
109
- the value of column 1 with 2.</p>
110
-
111
- </section>
112
-
113
-
114
-
115
-
116
- <section id="5Buntitled-5D" class="documentation-section">
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
- <section class="attribute-method-details" class="method-section">
125
- <header>
126
- <h3>Attributes</h3>
127
- </header>
128
-
129
-
130
- <div id="attribute-i-add_sum_row" class="method-detail">
131
- <div class="method-heading attribute-method-heading">
132
- <span class="method-name">add_sum_row</span><span
133
- class="attribute-access-type">[R]</span>
134
- </div>
135
-
136
- <div class="method-description">
137
-
138
- <p>if true add a sum row at the bottom of the out file</p>
139
-
140
- </div>
141
- </div>
142
-
143
- <div id="attribute-i-columns" class="method-detail">
144
- <div class="method-heading attribute-method-heading">
145
- <span class="method-name">columns</span><span
146
- class="attribute-access-type">[R]</span>
147
- </div>
148
-
149
- <div class="method-description">
150
-
151
- <p>filter that is used for columns</p>
152
-
153
- </div>
154
- </div>
155
-
156
- <div id="attribute-i-date_format" class="method-detail">
157
- <div class="method-heading attribute-method-heading">
158
- <span class="method-name">date_format</span><span
159
- class="attribute-access-type">[R]</span>
160
- </div>
161
-
162
- <div class="method-description">
163
-
164
- <p>date format for date operations</p>
165
-
166
- </div>
167
- </div>
168
-
169
- <div id="attribute-i-formulae" class="method-detail">
170
- <div class="method-heading attribute-method-heading">
171
- <span class="method-name">formulae</span><span
172
- class="attribute-access-type">[R]</span>
173
- </div>
174
-
175
- <div class="method-description">
176
-
177
- <p>the operations on columns</p>
178
-
179
- </div>
180
- </div>
181
-
182
- <div id="attribute-i-header" class="method-detail">
183
- <div class="method-heading attribute-method-heading">
184
- <span class="method-name">header</span><span
185
- class="attribute-access-type">[R]</span>
186
- </div>
187
-
188
- <div class="method-description">
189
-
190
- <p>header of the outfile</p>
191
-
192
- </div>
193
- </div>
194
-
195
- <div id="attribute-i-infile" class="method-detail">
196
- <div class="method-heading attribute-method-heading">
197
- <span class="method-name">infile</span><span
198
- class="attribute-access-type">[R]</span>
199
- </div>
200
-
201
- <div class="method-description">
202
-
203
- <p>infile contains the data that is operated on</p>
204
-
205
- </div>
206
- </div>
207
-
208
- <div id="attribute-i-outfile" class="method-detail">
209
- <div class="method-heading attribute-method-heading">
210
- <span class="method-name">outfile</span><span
211
- class="attribute-access-type">[R]</span>
212
- </div>
213
-
214
- <div class="method-description">
215
-
216
- <p>outfile is the file where the result is written to</p>
217
-
218
- </div>
219
- </div>
220
-
221
- <div id="attribute-i-row_filter" class="method-detail">
222
- <div class="method-heading attribute-method-heading">
223
- <span class="method-name">row_filter</span><span
224
- class="attribute-access-type">[R]</span>
225
- </div>
226
-
227
- <div class="method-description">
228
-
229
- <p>filter that is used for rows</p>
230
-
231
- </div>
232
- </div>
233
-
234
- </section>
235
-
236
-
237
-
238
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
239
- <header>
240
- <h3>Public Class Methods</h3>
241
- </header>
242
-
243
-
244
- <div id="method-c-new" class="method-detail ">
245
-
246
- <div class="method-heading">
247
- <span class="method-name">new</span><span
248
- class="method-args">(options={})</span>
249
-
250
- <span class="method-click-advice">click to toggle source</span>
251
-
252
- </div>
253
-
254
-
255
- <div class="method-description">
256
-
257
- <p>Creates a new <a href="Calculator.html">Calculator</a>. Options expects
258
- :infile, :outfile, :rows and :columns. Optionally a header can be provided.
259
- The header can be supplemented with additional column names that are
260
- generated due to a arithmetic operation that creates new columns</p>
261
-
262
-
263
-
264
-
265
- <div class="method-source-code" id="new-source">
266
- <pre><span class="ruby-comment"># File lib/sycsvpro/calculator.rb, line 36</span>
267
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
268
- <span class="ruby-ivar">@infile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:infile</span>]
269
- <span class="ruby-ivar">@outfile</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:outfile</span>]
270
- <span class="ruby-ivar">@date_format</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:df</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&quot;%Y-%m-%d&quot;</span>
271
- <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>])
272
- <span class="ruby-ivar">@header</span> = <span class="ruby-constant">Header</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:header</span>])
273
- <span class="ruby-ivar">@sum_row</span> = []
274
- <span class="ruby-ivar">@add_sum_row</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:sum</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword">false</span>
275
- <span class="ruby-ivar">@formulae</span> = {}
276
- <span class="ruby-identifier">create_calculator</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:cols</span>])
277
- <span class="ruby-keyword">end</span></pre>
278
- </div>
279
-
280
- </div>
281
-
282
-
283
-
284
-
285
- </div>
286
-
287
-
288
- </section>
289
-
290
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
291
- <header>
292
- <h3>Public Instance Methods</h3>
293
- </header>
294
-
295
-
296
- <div id="method-i-execute" class="method-detail ">
297
-
298
- <div class="method-heading">
299
- <span class="method-name">execute</span><span
300
- class="method-args">()</span>
301
-
302
- <span class="method-click-advice">click to toggle source</span>
303
-
304
- </div>
305
-
306
-
307
- <div class="method-description">
308
-
309
- <p>Executes the calculator</p>
310
-
311
-
312
-
313
-
314
- <div class="method-source-code" id="execute-source">
315
- <pre><span class="ruby-comment"># File lib/sycsvpro/calculator.rb, line 55</span>
316
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
317
- <span class="ruby-identifier">processed_header</span> = <span class="ruby-keyword">false</span>
318
-
319
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">outfile</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
320
- <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>
321
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">empty?</span>
322
-
323
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">processed_header</span>
324
- <span class="ruby-identifier">header_row</span> = <span class="ruby-identifier">header</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>)
325
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header_row</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">header_row</span>.<span class="ruby-identifier">empty?</span>
326
- <span class="ruby-identifier">processed_header</span> = <span class="ruby-keyword">true</span>
327
- <span class="ruby-keyword">next</span>
328
- <span class="ruby-keyword">end</span>
329
-
330
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</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>).<span class="ruby-identifier">nil?</span>
331
-
332
- <span class="ruby-ivar">@columns</span> = <span class="ruby-identifier">unstring</span>(<span class="ruby-identifier">line</span>).<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;;&#39;</span>)
333
- <span class="ruby-identifier">formulae</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span>, <span class="ruby-identifier">formula</span><span class="ruby-operator">|</span>
334
- <span class="ruby-ivar">@columns</span>[<span class="ruby-identifier">col</span>.<span class="ruby-identifier">to_i</span>] = <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">formula</span>)
335
- <span class="ruby-keyword">end</span>
336
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@columns</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;;&#39;</span>)
337
-
338
- <span class="ruby-ivar">@columns</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
339
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@sum_row</span>[<span class="ruby-identifier">index</span>]
340
- <span class="ruby-ivar">@sum_row</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">to_number</span> <span class="ruby-identifier">column</span>
341
- <span class="ruby-keyword">else</span>
342
- <span class="ruby-ivar">@sum_row</span>[<span class="ruby-identifier">index</span>] = <span class="ruby-identifier">to_number</span> <span class="ruby-identifier">column</span>
343
- <span class="ruby-keyword">end</span>
344
- <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">add_sum_row</span>
345
-
346
- <span class="ruby-keyword">end</span>
347
-
348
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@sum_row</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;;&#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">add_sum_row</span>
349
-
350
- <span class="ruby-keyword">end</span>
351
- <span class="ruby-keyword">end</span></pre>
352
- </div>
353
-
354
- </div>
355
-
356
-
357
-
358
-
359
- </div>
360
-
361
-
362
- <div id="method-i-method_missing" class="method-detail ">
363
-
364
- <div class="method-heading">
365
- <span class="method-name">method_missing</span><span
366
- class="method-args">(id, *args, &block)</span>
367
-
368
- <span class="method-click-advice">click to toggle source</span>
369
-
370
- </div>
371
-
372
-
373
- <div class="method-description">
374
-
375
- <p>Retrieves the values from a row as the result of a arithmetic operation</p>
376
-
377
-
378
-
379
-
380
- <div class="method-source-code" id="method_missing-source">
381
- <pre><span class="ruby-comment"># File lib/sycsvpro/calculator.rb, line 49</span>
382
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">id</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
383
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">to_number</span>(<span class="ruby-identifier">columns</span>[<span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/c(\d+)/</span>
384
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">to_date</span>(<span class="ruby-identifier">columns</span>[<span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/d(\d+)/</span>
385
- <span class="ruby-keyword">end</span></pre>
386
- </div>
387
-
388
- </div>
389
-
390
-
391
-
392
-
393
- </div>
394
-
395
-
396
- </section>
397
-
398
- </section>
399
- </main>
400
-
401
-
402
- <footer id="validator-badges" role="contentinfo">
403
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
404
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
405
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
406
- </footer>
407
-