sycsvpro 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -0
- data/bin/sycsvpro +37 -11
- data/html/Object.html +14 -0
- data/html/Sycsvpro/ScriptList.html +277 -0
- data/html/Sycsvpro.html +2 -0
- data/html/created.rid +6 -5
- data/html/index.html +2 -0
- data/html/js/search_index.js +1 -1
- data/html/table_of_contents.html +44 -31
- data/lib/sycsvpro/script_list.rb +51 -0
- data/lib/sycsvpro/version.rb +1 -1
- data/lib/sycsvpro.rb +1 -0
- data/spec/sycsvpro/files/script.rb +16 -0
- data/spec/sycsvpro/script_list_spec.rb +57 -0
- data/sycsvpro.rdoc +2 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 200bdc00de01fd102bec6290071adb632baec288
|
4
|
+
data.tar.gz: a26adffa7877ac00cf6cf2bcb5902f3842db5992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fda3aaaefbdd73d869c5c4ff879f60902ea15158671076775a49183bc44db19e883f600ab00f10b7a9c533eaf15977a41c0c7611332b48e19a82ec6ad8b04630
|
7
|
+
data.tar.gz: 5035fca1649a5c2457c50a2eacca90396bda949509b70072e7ac460f31daf6e79d8f82dee2648c64767fc386d59c438dda6ba3db553a322bdcd622dcc23f3b3a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,6 +11,7 @@ Processing of csv files. *sycsvpro* offers following functions
|
|
11
11
|
* count values in columns and use the value as column name
|
12
12
|
* arithmetic operations on values of columns
|
13
13
|
* create or edit a Ruby script
|
14
|
+
* list scripts available optionally with methods
|
14
15
|
* execute a Ruby script file that operates a csv file
|
15
16
|
|
16
17
|
To get help type
|
@@ -144,6 +145,14 @@ Creates or if it exists opens a file for editing. The file is created in the dir
|
|
144
145
|
|
145
146
|
$ sycsvpro edit -s script.rb -m call_me
|
146
147
|
|
148
|
+
List
|
149
|
+
----
|
150
|
+
List the scripts available in the scripts directory
|
151
|
+
|
152
|
+
$ sycsvpro list -m
|
153
|
+
script.rb
|
154
|
+
call_me
|
155
|
+
|
147
156
|
Execute
|
148
157
|
-------
|
149
158
|
|
data/bin/sycsvpro
CHANGED
@@ -132,6 +132,36 @@ command :edit do |c|
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
desc 'Lists scripts in the scripts directory with optionally listing methods'
|
136
|
+
command :list do |c|
|
137
|
+
c.desc 'Name of the script file'
|
138
|
+
c.arg_name 'SCRIPT_NAME.rb'
|
139
|
+
c.flag [:s, :script], :must_match => /^\w+\.rb/
|
140
|
+
|
141
|
+
c.desc 'Show methods'
|
142
|
+
c.switch [:m, :method]
|
143
|
+
|
144
|
+
c.action do |global_options,options,args|
|
145
|
+
script_list = Sycsvpro::ScriptList.new(dir: script_directory,
|
146
|
+
script: options[:s], show_methods: options[:m])
|
147
|
+
|
148
|
+
scripts = script_list.execute
|
149
|
+
|
150
|
+
if scripts.empty?
|
151
|
+
help_now! "No scripts available. You can create scripts with the edit command"
|
152
|
+
else
|
153
|
+
scripts.each do |script, methods|
|
154
|
+
puts File.basename(script)
|
155
|
+
methods.each do |method|
|
156
|
+
puts method.gsub(/^/, " ")
|
157
|
+
puts
|
158
|
+
end unless methods.empty?
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
135
165
|
desc 'Executes the code provided in a file'
|
136
166
|
arg_name 'PRO_FILE METHOD'
|
137
167
|
command :execute do |c|
|
@@ -252,12 +282,13 @@ pre do |global,command,options,args|
|
|
252
282
|
|
253
283
|
count = 0
|
254
284
|
|
255
|
-
unless command.name == :edit or command.name == :execute
|
285
|
+
unless command.name == :edit or command.name == :execute or command.name == :list
|
256
286
|
analyzer = Sycsvpro::Analyzer.new(global[:f])
|
257
287
|
result = analyzer.result
|
258
288
|
count = result.row_count
|
259
289
|
end
|
260
290
|
|
291
|
+
# Creates statistics on the command operation
|
261
292
|
Stats = Struct.new(:command, :start, :end, :count) do
|
262
293
|
def duration
|
263
294
|
self.end - self.start
|
@@ -273,7 +304,7 @@ pre do |global,command,options,args|
|
|
273
304
|
|
274
305
|
def to_s
|
275
306
|
if count > 0
|
276
|
-
sprintf("%s
|
307
|
+
sprintf("%s %.5f %s %d %s %.5f %s", "'#{self.command}' has run",
|
277
308
|
duration,
|
278
309
|
"seconds to operate",
|
279
310
|
self.count,
|
@@ -281,11 +312,9 @@ pre do |global,command,options,args|
|
|
281
312
|
average,
|
282
313
|
"ms per row")
|
283
314
|
else
|
284
|
-
sprintf("%s
|
285
|
-
|
286
|
-
|
287
|
-
self.count,
|
288
|
-
"rows")
|
315
|
+
sprintf("%s %.5f %s", "'#{self.command}' has run",
|
316
|
+
duration,
|
317
|
+
"seconds")
|
289
318
|
end
|
290
319
|
end
|
291
320
|
end
|
@@ -310,13 +339,10 @@ post do |global,command,options,args|
|
|
310
339
|
# Use skips_post before a command to skip this
|
311
340
|
# block on that command only
|
312
341
|
puts
|
313
|
-
print "-> "
|
314
342
|
|
315
343
|
@stats.end = Time.now
|
316
|
-
unless command.name == :edit
|
344
|
+
unless command.name == :edit
|
317
345
|
puts @stats
|
318
|
-
else
|
319
|
-
puts @stats if command.name == :execute
|
320
346
|
end
|
321
347
|
end
|
322
348
|
|
data/html/Object.html
CHANGED
@@ -100,6 +100,20 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
+
<section class="constants-list">
|
104
|
+
<header>
|
105
|
+
<h3>Constants</h3>
|
106
|
+
</header>
|
107
|
+
<dl>
|
108
|
+
|
109
|
+
<dt id="Stats">Stats
|
110
|
+
|
111
|
+
<dd><p>Creates statistics on the command operation</p>
|
112
|
+
|
113
|
+
|
114
|
+
</dl>
|
115
|
+
</section>
|
116
|
+
|
103
117
|
|
104
118
|
|
105
119
|
|
@@ -0,0 +1,277 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Sycsvpro::ScriptList - 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::ScriptList">
|
87
|
+
<h1 id="class-Sycsvpro::ScriptList" class="class">
|
88
|
+
class Sycsvpro::ScriptList
|
89
|
+
</h1>
|
90
|
+
|
91
|
+
<section class="description">
|
92
|
+
|
93
|
+
<p>Lists the contents of the script directory. Optionally listing a specific
|
94
|
+
script file and also optionally the methods and associated description of
|
95
|
+
the methods</p>
|
96
|
+
|
97
|
+
</section>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<section class="attribute-method-details" class="method-section">
|
111
|
+
<header>
|
112
|
+
<h3>Attributes</h3>
|
113
|
+
</header>
|
114
|
+
|
115
|
+
|
116
|
+
<div id="attribute-i-list" class="method-detail">
|
117
|
+
<div class="method-heading attribute-method-heading">
|
118
|
+
<span class="method-name">list</span><span
|
119
|
+
class="attribute-access-type">[R]</span>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
|
124
|
+
<p>Hash holding the list of scripts</p>
|
125
|
+
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div id="attribute-i-script_dir" class="method-detail">
|
130
|
+
<div class="method-heading attribute-method-heading">
|
131
|
+
<span class="method-name">script_dir</span><span
|
132
|
+
class="attribute-access-type">[R]</span>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div class="method-description">
|
136
|
+
|
137
|
+
<p>Directory that holds the scripts</p>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="attribute-i-script_file" class="method-detail">
|
143
|
+
<div class="method-heading attribute-method-heading">
|
144
|
+
<span class="method-name">script_file</span><span
|
145
|
+
class="attribute-access-type">[R]</span>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
|
150
|
+
<p>Script file of interest</p>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div id="attribute-i-show_methods" class="method-detail">
|
156
|
+
<div class="method-heading attribute-method-heading">
|
157
|
+
<span class="method-name">show_methods</span><span
|
158
|
+
class="attribute-access-type">[R]</span>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
|
163
|
+
<p>Switch indicating whether to show methods</p>
|
164
|
+
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
</section>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
173
|
+
<header>
|
174
|
+
<h3>Public Class Methods</h3>
|
175
|
+
</header>
|
176
|
+
|
177
|
+
|
178
|
+
<div id="method-c-new" class="method-detail ">
|
179
|
+
|
180
|
+
<div class="method-heading">
|
181
|
+
<span class="method-name">new</span><span
|
182
|
+
class="method-args">(options={})</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>Creates a new <a href="ScriptList.html">ScriptList</a>. Takes params <a
|
192
|
+
href="ScriptList.html#attribute-i-script_dir">#script_dir</a>, <a
|
193
|
+
href="ScriptList.html#attribute-i-script_file">#script_file</a> and <a
|
194
|
+
href="ScriptList.html#attribute-i-show_methods">#show_methods</a></p>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<div class="method-source-code" id="new-source">
|
200
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/script_list.rb, line 18</span>
|
201
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
202
|
+
<span class="ruby-ivar">@script_dir</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:dir</span>]
|
203
|
+
<span class="ruby-ivar">@script_file</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:script</span>] <span class="ruby-operator">||</span> <span class="ruby-string">'*.rb'</span>
|
204
|
+
<span class="ruby-ivar">@show_methods</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:show_methods</span>]
|
205
|
+
<span class="ruby-ivar">@list</span> = {}
|
206
|
+
<span class="ruby-keyword">end</span></pre>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
</section>
|
218
|
+
|
219
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
220
|
+
<header>
|
221
|
+
<h3>Public Instance Methods</h3>
|
222
|
+
</header>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="method-i-execute" class="method-detail ">
|
226
|
+
|
227
|
+
<div class="method-heading">
|
228
|
+
<span class="method-name">execute</span><span
|
229
|
+
class="method-args">()</span>
|
230
|
+
|
231
|
+
<span class="method-click-advice">click to toggle source</span>
|
232
|
+
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
|
238
|
+
<p>Retrieves the information about scripts and methods from the script
|
239
|
+
directory</p>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<div class="method-source-code" id="execute-source">
|
245
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/script_list.rb, line 26</span>
|
246
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>
|
247
|
+
<span class="ruby-identifier">scripts</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@script_dir</span>, <span class="ruby-ivar">@script_file</span>))
|
248
|
+
<span class="ruby-identifier">scripts</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">script</span><span class="ruby-operator">|</span>
|
249
|
+
<span class="ruby-identifier">list</span>[<span class="ruby-identifier">script</span>] = []
|
250
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">show_methods</span>
|
251
|
+
<span class="ruby-identifier">list</span>[<span class="ruby-identifier">script</span>] = <span class="ruby-identifier">retrieve_methods</span>(<span class="ruby-identifier">script</span>)
|
252
|
+
<span class="ruby-keyword">end</span>
|
253
|
+
<span class="ruby-keyword">end</span>
|
254
|
+
<span class="ruby-identifier">list</span>
|
255
|
+
<span class="ruby-keyword">end</span></pre>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
</section>
|
267
|
+
|
268
|
+
</section>
|
269
|
+
</main>
|
270
|
+
|
271
|
+
|
272
|
+
<footer id="validator-badges" role="contentinfo">
|
273
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
274
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
275
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
276
|
+
</footer>
|
277
|
+
|
data/html/Sycsvpro.html
CHANGED
data/html/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
Sun, 23 Feb 2014 13:56:52 +0100
|
2
2
|
README.rdoc Sun, 16 Feb 2014 22:01:46 +0100
|
3
|
-
lib/sycsvpro.rb
|
3
|
+
lib/sycsvpro.rb Sun, 23 Feb 2014 12:40:24 +0100
|
4
4
|
lib/sycsvpro/allocator.rb Wed, 19 Feb 2014 20:34:28 +0100
|
5
5
|
lib/sycsvpro/analyzer.rb Tue, 18 Feb 2014 19:57:28 +0100
|
6
6
|
lib/sycsvpro/calculator.rb Tue, 18 Feb 2014 19:53:34 +0100
|
@@ -8,12 +8,13 @@ lib/sycsvpro/collector.rb Sun, 16 Feb 2014 20:59:27 +0100
|
|
8
8
|
lib/sycsvpro/column_filter.rb Sun, 16 Feb 2014 21:10:11 +0100
|
9
9
|
lib/sycsvpro/counter.rb Fri, 21 Feb 2014 21:11:49 +0100
|
10
10
|
lib/sycsvpro/dsl.rb Tue, 18 Feb 2014 21:34:51 +0100
|
11
|
-
lib/sycsvpro/extractor.rb
|
11
|
+
lib/sycsvpro/extractor.rb Sat, 22 Feb 2014 17:58:18 +0100
|
12
12
|
lib/sycsvpro/filter.rb Tue, 18 Feb 2014 20:23:57 +0100
|
13
13
|
lib/sycsvpro/header.rb Tue, 18 Feb 2014 19:50:26 +0100
|
14
14
|
lib/sycsvpro/mapper.rb Tue, 18 Feb 2014 19:45:47 +0100
|
15
15
|
lib/sycsvpro/profiler.rb Sun, 16 Feb 2014 21:31:39 +0100
|
16
16
|
lib/sycsvpro/row_filter.rb Tue, 18 Feb 2014 19:45:25 +0100
|
17
17
|
lib/sycsvpro/script_creator.rb Fri, 21 Feb 2014 22:42:17 +0100
|
18
|
-
lib/sycsvpro/
|
19
|
-
|
18
|
+
lib/sycsvpro/script_list.rb Sun, 23 Feb 2014 13:56:43 +0100
|
19
|
+
lib/sycsvpro/version.rb Sat, 22 Feb 2014 22:06:58 +0100
|
20
|
+
bin/sycsvpro Sun, 23 Feb 2014 13:55:33 +0100
|
data/html/index.html
CHANGED
data/html/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["dsl","object","sycsvpro","allocator","analyzer","calculator","collector","columnfilter","counter","extractor","filter","header","mapper","profiler","rowfilter","scriptcreator","execute()","execute()","execute()","execute()","execute()","execute()","execute()","has_filter?()","method_missing()","method_missing()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","pivot_each_column()","process()","process()","process()","process()","process_file()","result()","rows()","unstring()","write_result()","write_to()","readme"],"longSearchIndex":["dsl","object","sycsvpro","sycsvpro::allocator","sycsvpro::analyzer","sycsvpro::calculator","sycsvpro::collector","sycsvpro::columnfilter","sycsvpro::counter","sycsvpro::extractor","sycsvpro::filter","sycsvpro::header","sycsvpro::mapper","sycsvpro::profiler","sycsvpro::rowfilter","sycsvpro::scriptcreator","sycsvpro::allocator#execute()","sycsvpro::calculator#execute()","sycsvpro::collector#execute()","sycsvpro::counter#execute()","sycsvpro::extractor#execute()","sycsvpro::mapper#execute()","sycsvpro::profiler#execute()","sycsvpro::filter#has_filter?()","sycsvpro::calculator#method_missing()","sycsvpro::filter#method_missing()","sycsvpro::allocator::new()","sycsvpro::analyzer::new()","sycsvpro::calculator::new()","sycsvpro::collector::new()","sycsvpro::counter::new()","sycsvpro::extractor::new()","sycsvpro::filter::new()","sycsvpro::header::new()","sycsvpro::mapper::new()","sycsvpro::profiler::new()","sycsvpro::scriptcreator::new()","sycsvpro::filter#pivot_each_column()","sycsvpro::columnfilter#process()","sycsvpro::filter#process()","sycsvpro::header#process()","sycsvpro::rowfilter#process()","sycsvpro::counter#process_file()","sycsvpro::analyzer#result()","dsl#rows()","dsl#unstring()","sycsvpro::counter#write_result()","dsl#write_to()",""],"info":[["Dsl","","Dsl.html","","<p>Methods to be used in customer specific script files\n"],["Object","","Object.html","",""],["Sycsvpro","","Sycsvpro.html","","<p>Operating csv files\n<p>Operating csv files\n<p>Operating csv files\n"],["Sycsvpro::Allocator","","Sycsvpro/Allocator.html","","<p>Allocates columns to a key column\n"],["Sycsvpro::Analyzer","","Sycsvpro/Analyzer.html","","<p>Analyzes the file structure\n"],["Sycsvpro::Calculator","","Sycsvpro/Calculator.html","","<p>Processes arithmetic operations on columns of a csv file. A column value\nhas to be a number. Possible …\n"],["Sycsvpro::Collector","","Sycsvpro/Collector.html","","<p>Collects values from rows and groups them in categories\n"],["Sycsvpro::ColumnFilter","","Sycsvpro/ColumnFilter.html","","<p>Creates a new column filter\n"],["Sycsvpro::Counter","","Sycsvpro/Counter.html","","<p>Creates a new counter that counts values and uses the values as column\nnames and uses the count as the …\n"],["Sycsvpro::Extractor","","Sycsvpro/Extractor.html","","<p>Extracts rows and columns from a csv file\n"],["Sycsvpro::Filter","","Sycsvpro/Filter.html","","<p>Creates a new filter that can be extended by sub-classes. A sub-class needs\nto override the process method …\n"],["Sycsvpro::Header","","Sycsvpro/Header.html","","<p>Creates a header\n"],["Sycsvpro::Mapper","","Sycsvpro/Mapper.html","","<p>Map values to new values described in a mapping file\n"],["Sycsvpro::Profiler","","Sycsvpro/Profiler.html","","<p>A profiler takes a Ruby script and executes the provided method in the\nscript\n"],["Sycsvpro::RowFilter","","Sycsvpro/RowFilter.html","","<p>Filters rows based on provided patterns\n"],["Sycsvpro::ScriptCreator","","Sycsvpro/ScriptCreator.html","","<p>Creates a ruby script scaffold\n"],["execute","Sycsvpro::Allocator","Sycsvpro/Allocator.html#method-i-execute","()","<p>Executes the allocator and assigns column values to the key\n"],["execute","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-i-execute","()","<p>Executes the calculator\n"],["execute","Sycsvpro::Collector","Sycsvpro/Collector.html#method-i-execute","()","<p>Execute the collector\n"],["execute","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-execute","()","<p>Executes the counter\n"],["execute","Sycsvpro::Extractor","Sycsvpro/Extractor.html#method-i-execute","()","<p>Executes the extractor\n"],["execute","Sycsvpro::Mapper","Sycsvpro/Mapper.html#method-i-execute","()","<p>Executes the mapper\n"],["execute","Sycsvpro::Profiler","Sycsvpro/Profiler.html#method-i-execute","(method)","<p>Executes the provided method in the Ruby script\n"],["has_filter?","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-has_filter-3F","()","<p>Checks whether a filter has been set. Returns true if filter has been set\notherwise false\n"],["method_missing","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-i-method_missing","(id, *args, &block)","<p>Retrieves the values from a row as the result of a arithmetic operation\n"],["method_missing","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-method_missing","(id, *args, &block)","<p>Creates the filters based on the given patterns\n"],["new","Sycsvpro::Allocator","Sycsvpro/Allocator.html#method-c-new","(options={})","<p>Creates a new allocator. Options are infile, outfile, key, rows and columns\nto allocate to key\n"],["new","Sycsvpro::Analyzer","Sycsvpro/Analyzer.html#method-c-new","(file)","<p>Creates a new analyzer\n"],["new","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-c-new","(options={})","<p>Creates a new Calculator. Options expects :infile, :outfile, :rows and\n:columns. Optionally a header …\n"],["new","Sycsvpro::Collector","Sycsvpro/Collector.html#method-c-new","(options={})","<p>Creates a new Collector\n"],["new","Sycsvpro::Counter","Sycsvpro/Counter.html#method-c-new","(options={})","<p>Creates a new counter. Takes as attributes infile, outfile, key, rows,\ncols, date-format and indicator …\n"],["new","Sycsvpro::Extractor","Sycsvpro/Extractor.html#method-c-new","(options={})","<p>Creates a new extractor\n"],["new","Sycsvpro::Filter","Sycsvpro/Filter.html#method-c-new","(values, options={})","<p>Creates a new filter\n"],["new","Sycsvpro::Header","Sycsvpro/Header.html#method-c-new","(header)","<p>Create a new header\n"],["new","Sycsvpro::Mapper","Sycsvpro/Mapper.html#method-c-new","(options={})","<p>Creates new mapper\n"],["new","Sycsvpro::Profiler","Sycsvpro/Profiler.html#method-c-new","(pro_file)","<p>Creates a new profiler\n"],["new","Sycsvpro::ScriptCreator","Sycsvpro/ScriptCreator.html#method-c-new","(options={})","<p>Creates a new ScriptCreator\n"],["pivot_each_column","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-pivot_each_column","(values=[])","<p>Yields the column value and whether the filter matches the column\n"],["process","Sycsvpro::ColumnFilter","Sycsvpro/ColumnFilter.html#method-i-process","(object, options={})","<p>Processes the filter and returns the values that respect the filter\n"],["process","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-process","(object, options={})","<p>Processes the filter. Needs to be overridden by the sub-class\n"],["process","Sycsvpro::Header","Sycsvpro/Header.html#method-i-process","(line)","<p>Returns the header\n"],["process","Sycsvpro::RowFilter","Sycsvpro/RowFilter.html#method-i-process","(object, options={})","<p>Processes the filter on the given row\n"],["process_file","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-process_file","()","<p>Processes the counting on the in file\n"],["result","Sycsvpro::Analyzer","Sycsvpro/Analyzer.html#method-i-result","()","<p>Analyzes the file and returns the result\n"],["rows","Dsl","Dsl.html#method-i-rows","(options={})","<p>Retrieves rows and columns from the file and returns them to the block\nprovided by the caller\n"],["unstring","Dsl","Dsl.html#method-i-unstring","(line)","<p>Remove leading and trailing “ and spaces as well as reducing more than 2\nspaces between words from …\n"],["write_result","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-write_result","()","<p>Writes the results\n"],["write_to","Dsl","Dsl.html#method-i-write_to","(file)","<p>writes values provided by a block to the given file\n"],["README","","README_rdoc.html","","<p>sycsvpro\n<p>Author — Pierre Sugar (pierre@sugaryourcoffee.de)\n<p>Copyright — Copyright © 2014 by Pierre Sugar\n"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["dsl","object","sycsvpro","allocator","analyzer","calculator","collector","columnfilter","counter","extractor","filter","header","mapper","profiler","rowfilter","scriptcreator","scriptlist","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","has_filter?()","method_missing()","method_missing()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","pivot_each_column()","process()","process()","process()","process()","process_file()","result()","rows()","unstring()","write_result()","write_to()","readme"],"longSearchIndex":["dsl","object","sycsvpro","sycsvpro::allocator","sycsvpro::analyzer","sycsvpro::calculator","sycsvpro::collector","sycsvpro::columnfilter","sycsvpro::counter","sycsvpro::extractor","sycsvpro::filter","sycsvpro::header","sycsvpro::mapper","sycsvpro::profiler","sycsvpro::rowfilter","sycsvpro::scriptcreator","sycsvpro::scriptlist","sycsvpro::allocator#execute()","sycsvpro::calculator#execute()","sycsvpro::collector#execute()","sycsvpro::counter#execute()","sycsvpro::extractor#execute()","sycsvpro::mapper#execute()","sycsvpro::profiler#execute()","sycsvpro::scriptlist#execute()","sycsvpro::filter#has_filter?()","sycsvpro::calculator#method_missing()","sycsvpro::filter#method_missing()","sycsvpro::allocator::new()","sycsvpro::analyzer::new()","sycsvpro::calculator::new()","sycsvpro::collector::new()","sycsvpro::counter::new()","sycsvpro::extractor::new()","sycsvpro::filter::new()","sycsvpro::header::new()","sycsvpro::mapper::new()","sycsvpro::profiler::new()","sycsvpro::scriptcreator::new()","sycsvpro::scriptlist::new()","sycsvpro::filter#pivot_each_column()","sycsvpro::columnfilter#process()","sycsvpro::filter#process()","sycsvpro::header#process()","sycsvpro::rowfilter#process()","sycsvpro::counter#process_file()","sycsvpro::analyzer#result()","dsl#rows()","dsl#unstring()","sycsvpro::counter#write_result()","dsl#write_to()",""],"info":[["Dsl","","Dsl.html","","<p>Methods to be used in customer specific script files\n"],["Object","","Object.html","",""],["Sycsvpro","","Sycsvpro.html","","<p>Operating csv files\n<p>Operating csv files\n<p>Operating csv files\n"],["Sycsvpro::Allocator","","Sycsvpro/Allocator.html","","<p>Allocates columns to a key column\n"],["Sycsvpro::Analyzer","","Sycsvpro/Analyzer.html","","<p>Analyzes the file structure\n"],["Sycsvpro::Calculator","","Sycsvpro/Calculator.html","","<p>Processes arithmetic operations on columns of a csv file. A column value\nhas to be a number. Possible …\n"],["Sycsvpro::Collector","","Sycsvpro/Collector.html","","<p>Collects values from rows and groups them in categories\n"],["Sycsvpro::ColumnFilter","","Sycsvpro/ColumnFilter.html","","<p>Creates a new column filter\n"],["Sycsvpro::Counter","","Sycsvpro/Counter.html","","<p>Creates a new counter that counts values and uses the values as column\nnames and uses the count as the …\n"],["Sycsvpro::Extractor","","Sycsvpro/Extractor.html","","<p>Extracts rows and columns from a csv file\n"],["Sycsvpro::Filter","","Sycsvpro/Filter.html","","<p>Creates a new filter that can be extended by sub-classes. A sub-class needs\nto override the process method …\n"],["Sycsvpro::Header","","Sycsvpro/Header.html","","<p>Creates a header\n"],["Sycsvpro::Mapper","","Sycsvpro/Mapper.html","","<p>Map values to new values described in a mapping file\n"],["Sycsvpro::Profiler","","Sycsvpro/Profiler.html","","<p>A profiler takes a Ruby script and executes the provided method in the\nscript\n"],["Sycsvpro::RowFilter","","Sycsvpro/RowFilter.html","","<p>Filters rows based on provided patterns\n"],["Sycsvpro::ScriptCreator","","Sycsvpro/ScriptCreator.html","","<p>Creates a ruby script scaffold\n"],["Sycsvpro::ScriptList","","Sycsvpro/ScriptList.html","","<p>Lists the contents of the script directory. Optionally listing a specific\nscript file and also optionally …\n"],["execute","Sycsvpro::Allocator","Sycsvpro/Allocator.html#method-i-execute","()","<p>Executes the allocator and assigns column values to the key\n"],["execute","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-i-execute","()","<p>Executes the calculator\n"],["execute","Sycsvpro::Collector","Sycsvpro/Collector.html#method-i-execute","()","<p>Execute the collector\n"],["execute","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-execute","()","<p>Executes the counter\n"],["execute","Sycsvpro::Extractor","Sycsvpro/Extractor.html#method-i-execute","()","<p>Executes the extractor\n"],["execute","Sycsvpro::Mapper","Sycsvpro/Mapper.html#method-i-execute","()","<p>Executes the mapper\n"],["execute","Sycsvpro::Profiler","Sycsvpro/Profiler.html#method-i-execute","(method)","<p>Executes the provided method in the Ruby script\n"],["execute","Sycsvpro::ScriptList","Sycsvpro/ScriptList.html#method-i-execute","()","<p>Retrieves the information about scripts and methods from the script\ndirectory\n"],["has_filter?","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-has_filter-3F","()","<p>Checks whether a filter has been set. Returns true if filter has been set\notherwise false\n"],["method_missing","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-i-method_missing","(id, *args, &block)","<p>Retrieves the values from a row as the result of a arithmetic operation\n"],["method_missing","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-method_missing","(id, *args, &block)","<p>Creates the filters based on the given patterns\n"],["new","Sycsvpro::Allocator","Sycsvpro/Allocator.html#method-c-new","(options={})","<p>Creates a new allocator. Options are infile, outfile, key, rows and columns\nto allocate to key\n"],["new","Sycsvpro::Analyzer","Sycsvpro/Analyzer.html#method-c-new","(file)","<p>Creates a new analyzer\n"],["new","Sycsvpro::Calculator","Sycsvpro/Calculator.html#method-c-new","(options={})","<p>Creates a new Calculator. Options expects :infile, :outfile, :rows and\n:columns. Optionally a header …\n"],["new","Sycsvpro::Collector","Sycsvpro/Collector.html#method-c-new","(options={})","<p>Creates a new Collector\n"],["new","Sycsvpro::Counter","Sycsvpro/Counter.html#method-c-new","(options={})","<p>Creates a new counter. Takes as attributes infile, outfile, key, rows,\ncols, date-format and indicator …\n"],["new","Sycsvpro::Extractor","Sycsvpro/Extractor.html#method-c-new","(options={})","<p>Creates a new extractor\n"],["new","Sycsvpro::Filter","Sycsvpro/Filter.html#method-c-new","(values, options={})","<p>Creates a new filter\n"],["new","Sycsvpro::Header","Sycsvpro/Header.html#method-c-new","(header)","<p>Create a new header\n"],["new","Sycsvpro::Mapper","Sycsvpro/Mapper.html#method-c-new","(options={})","<p>Creates new mapper\n"],["new","Sycsvpro::Profiler","Sycsvpro/Profiler.html#method-c-new","(pro_file)","<p>Creates a new profiler\n"],["new","Sycsvpro::ScriptCreator","Sycsvpro/ScriptCreator.html#method-c-new","(options={})","<p>Creates a new ScriptCreator\n"],["new","Sycsvpro::ScriptList","Sycsvpro/ScriptList.html#method-c-new","(options={})","<p>Creates a new ScriptList. Takes params script_dir, script_file and\nshow_methods\n"],["pivot_each_column","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-pivot_each_column","(values=[])","<p>Yields the column value and whether the filter matches the column\n"],["process","Sycsvpro::ColumnFilter","Sycsvpro/ColumnFilter.html#method-i-process","(object, options={})","<p>Processes the filter and returns the values that respect the filter\n"],["process","Sycsvpro::Filter","Sycsvpro/Filter.html#method-i-process","(object, options={})","<p>Processes the filter. Needs to be overridden by the sub-class\n"],["process","Sycsvpro::Header","Sycsvpro/Header.html#method-i-process","(line)","<p>Returns the header\n"],["process","Sycsvpro::RowFilter","Sycsvpro/RowFilter.html#method-i-process","(object, options={})","<p>Processes the filter on the given row\n"],["process_file","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-process_file","()","<p>Processes the counting on the in file\n"],["result","Sycsvpro::Analyzer","Sycsvpro/Analyzer.html#method-i-result","()","<p>Analyzes the file and returns the result\n"],["rows","Dsl","Dsl.html#method-i-rows","(options={})","<p>Retrieves rows and columns from the file and returns them to the block\nprovided by the caller\n"],["unstring","Dsl","Dsl.html#method-i-unstring","(line)","<p>Remove leading and trailing “ and spaces as well as reducing more than 2\nspaces between words from …\n"],["write_result","Sycsvpro::Counter","Sycsvpro/Counter.html#method-i-write_result","()","<p>Writes the results\n"],["write_to","Dsl","Dsl.html#method-i-write_to","(file)","<p>writes values provided by a block to the given file\n"],["README","","README_rdoc.html","","<p>sycsvpro\n<p>Author — Pierre Sugar (pierre@sugaryourcoffee.de)\n<p>Copyright — Copyright © 2014 by Pierre Sugar\n"]]}}
|
data/html/table_of_contents.html
CHANGED
@@ -91,6 +91,9 @@
|
|
91
91
|
<li class="class">
|
92
92
|
<a href="Sycsvpro/ScriptCreator.html">Sycsvpro::ScriptCreator</a>
|
93
93
|
</li>
|
94
|
+
<li class="class">
|
95
|
+
<a href="Sycsvpro/ScriptList.html">Sycsvpro::ScriptList</a>
|
96
|
+
</li>
|
94
97
|
</ul>
|
95
98
|
|
96
99
|
<h2 id="methods">Methods</h2>
|
@@ -102,9 +105,9 @@
|
|
102
105
|
<span class="container">Sycsvpro::Allocator</span>
|
103
106
|
|
104
107
|
<li class="method">
|
105
|
-
<a href="Sycsvpro/
|
108
|
+
<a href="Sycsvpro/Profiler.html#method-c-new">::new</a>
|
106
109
|
—
|
107
|
-
<span class="container">Sycsvpro::
|
110
|
+
<span class="container">Sycsvpro::Profiler</span>
|
108
111
|
|
109
112
|
<li class="method">
|
110
113
|
<a href="Sycsvpro/Analyzer.html#method-c-new">::new</a>
|
@@ -112,9 +115,9 @@
|
|
112
115
|
<span class="container">Sycsvpro::Analyzer</span>
|
113
116
|
|
114
117
|
<li class="method">
|
115
|
-
<a href="Sycsvpro/
|
118
|
+
<a href="Sycsvpro/Mapper.html#method-c-new">::new</a>
|
116
119
|
—
|
117
|
-
<span class="container">Sycsvpro::
|
120
|
+
<span class="container">Sycsvpro::Mapper</span>
|
118
121
|
|
119
122
|
<li class="method">
|
120
123
|
<a href="Sycsvpro/Calculator.html#method-c-new">::new</a>
|
@@ -122,14 +125,14 @@
|
|
122
125
|
<span class="container">Sycsvpro::Calculator</span>
|
123
126
|
|
124
127
|
<li class="method">
|
125
|
-
<a href="Sycsvpro/
|
128
|
+
<a href="Sycsvpro/Filter.html#method-c-new">::new</a>
|
126
129
|
—
|
127
|
-
<span class="container">Sycsvpro::
|
130
|
+
<span class="container">Sycsvpro::Filter</span>
|
128
131
|
|
129
132
|
<li class="method">
|
130
|
-
<a href="Sycsvpro/
|
133
|
+
<a href="Sycsvpro/Extractor.html#method-c-new">::new</a>
|
131
134
|
—
|
132
|
-
<span class="container">Sycsvpro::
|
135
|
+
<span class="container">Sycsvpro::Extractor</span>
|
133
136
|
|
134
137
|
<li class="method">
|
135
138
|
<a href="Sycsvpro/Collector.html#method-c-new">::new</a>
|
@@ -137,29 +140,29 @@
|
|
137
140
|
<span class="container">Sycsvpro::Collector</span>
|
138
141
|
|
139
142
|
<li class="method">
|
140
|
-
<a href="Sycsvpro/
|
143
|
+
<a href="Sycsvpro/ScriptCreator.html#method-c-new">::new</a>
|
141
144
|
—
|
142
|
-
<span class="container">Sycsvpro::
|
145
|
+
<span class="container">Sycsvpro::ScriptCreator</span>
|
143
146
|
|
144
147
|
<li class="method">
|
145
|
-
<a href="Sycsvpro/
|
148
|
+
<a href="Sycsvpro/ScriptList.html#method-c-new">::new</a>
|
146
149
|
—
|
147
|
-
<span class="container">Sycsvpro::
|
150
|
+
<span class="container">Sycsvpro::ScriptList</span>
|
148
151
|
|
149
152
|
<li class="method">
|
150
|
-
<a href="Sycsvpro/
|
153
|
+
<a href="Sycsvpro/Counter.html#method-c-new">::new</a>
|
151
154
|
—
|
152
|
-
<span class="container">Sycsvpro::
|
155
|
+
<span class="container">Sycsvpro::Counter</span>
|
153
156
|
|
154
157
|
<li class="method">
|
155
|
-
<a href="Sycsvpro/
|
158
|
+
<a href="Sycsvpro/Header.html#method-c-new">::new</a>
|
156
159
|
—
|
157
|
-
<span class="container">Sycsvpro::
|
160
|
+
<span class="container">Sycsvpro::Header</span>
|
158
161
|
|
159
162
|
<li class="method">
|
160
|
-
<a href="Sycsvpro/
|
163
|
+
<a href="Sycsvpro/Collector.html#method-i-execute">#execute</a>
|
161
164
|
—
|
162
|
-
<span class="container">Sycsvpro::
|
165
|
+
<span class="container">Sycsvpro::Collector</span>
|
163
166
|
|
164
167
|
<li class="method">
|
165
168
|
<a href="Sycsvpro/Profiler.html#method-i-execute">#execute</a>
|
@@ -167,9 +170,9 @@
|
|
167
170
|
<span class="container">Sycsvpro::Profiler</span>
|
168
171
|
|
169
172
|
<li class="method">
|
170
|
-
<a href="Sycsvpro/
|
173
|
+
<a href="Sycsvpro/Calculator.html#method-i-execute">#execute</a>
|
171
174
|
—
|
172
|
-
<span class="container">Sycsvpro::
|
175
|
+
<span class="container">Sycsvpro::Calculator</span>
|
173
176
|
|
174
177
|
<li class="method">
|
175
178
|
<a href="Sycsvpro/Extractor.html#method-i-execute">#execute</a>
|
@@ -177,22 +180,27 @@
|
|
177
180
|
<span class="container">Sycsvpro::Extractor</span>
|
178
181
|
|
179
182
|
<li class="method">
|
180
|
-
<a href="Sycsvpro/
|
183
|
+
<a href="Sycsvpro/Counter.html#method-i-execute">#execute</a>
|
181
184
|
—
|
182
|
-
<span class="container">Sycsvpro::
|
185
|
+
<span class="container">Sycsvpro::Counter</span>
|
183
186
|
|
184
187
|
<li class="method">
|
185
|
-
<a href="Sycsvpro/
|
188
|
+
<a href="Sycsvpro/Mapper.html#method-i-execute">#execute</a>
|
186
189
|
—
|
187
|
-
<span class="container">Sycsvpro::
|
190
|
+
<span class="container">Sycsvpro::Mapper</span>
|
188
191
|
|
189
192
|
<li class="method">
|
190
|
-
<a href="Sycsvpro/
|
193
|
+
<a href="Sycsvpro/Allocator.html#method-i-execute">#execute</a>
|
191
194
|
—
|
192
|
-
<span class="container">Sycsvpro::
|
195
|
+
<span class="container">Sycsvpro::Allocator</span>
|
193
196
|
|
194
197
|
<li class="method">
|
195
|
-
<a href="Sycsvpro/
|
198
|
+
<a href="Sycsvpro/ScriptList.html#method-i-execute">#execute</a>
|
199
|
+
—
|
200
|
+
<span class="container">Sycsvpro::ScriptList</span>
|
201
|
+
|
202
|
+
<li class="method">
|
203
|
+
<a href="Sycsvpro/Filter.html#method-i-has_filter-3F">#has_filter?</a>
|
196
204
|
—
|
197
205
|
<span class="container">Sycsvpro::Filter</span>
|
198
206
|
|
@@ -201,6 +209,11 @@
|
|
201
209
|
—
|
202
210
|
<span class="container">Sycsvpro::Calculator</span>
|
203
211
|
|
212
|
+
<li class="method">
|
213
|
+
<a href="Sycsvpro/Filter.html#method-i-method_missing">#method_missing</a>
|
214
|
+
—
|
215
|
+
<span class="container">Sycsvpro::Filter</span>
|
216
|
+
|
204
217
|
<li class="method">
|
205
218
|
<a href="Sycsvpro/Filter.html#method-i-pivot_each_column">#pivot_each_column</a>
|
206
219
|
—
|
@@ -212,9 +225,9 @@
|
|
212
225
|
<span class="container">Sycsvpro::Filter</span>
|
213
226
|
|
214
227
|
<li class="method">
|
215
|
-
<a href="Sycsvpro/
|
228
|
+
<a href="Sycsvpro/Header.html#method-i-process">#process</a>
|
216
229
|
—
|
217
|
-
<span class="container">Sycsvpro::
|
230
|
+
<span class="container">Sycsvpro::Header</span>
|
218
231
|
|
219
232
|
<li class="method">
|
220
233
|
<a href="Sycsvpro/ColumnFilter.html#method-i-process">#process</a>
|
@@ -222,9 +235,9 @@
|
|
222
235
|
<span class="container">Sycsvpro::ColumnFilter</span>
|
223
236
|
|
224
237
|
<li class="method">
|
225
|
-
<a href="Sycsvpro/
|
238
|
+
<a href="Sycsvpro/RowFilter.html#method-i-process">#process</a>
|
226
239
|
—
|
227
|
-
<span class="container">Sycsvpro::
|
240
|
+
<span class="container">Sycsvpro::RowFilter</span>
|
228
241
|
|
229
242
|
<li class="method">
|
230
243
|
<a href="Sycsvpro/Counter.html#method-i-process_file">#process_file</a>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Operating csv files
|
2
|
+
module Sycsvpro
|
3
|
+
|
4
|
+
# Lists the contents of the script directory. Optionally listing a specific script file and also
|
5
|
+
# optionally the methods and associated description of the methods
|
6
|
+
class ScriptList
|
7
|
+
|
8
|
+
# Directory that holds the scripts
|
9
|
+
attr_reader :script_dir
|
10
|
+
# Script file of interest
|
11
|
+
attr_reader :script_file
|
12
|
+
# Switch indicating whether to show methods
|
13
|
+
attr_reader :show_methods
|
14
|
+
# Hash holding the list of scripts
|
15
|
+
attr_reader :list
|
16
|
+
|
17
|
+
# Creates a new ScriptList. Takes params script_dir, script_file and show_methods
|
18
|
+
def initialize(options={})
|
19
|
+
@script_dir = options[:dir]
|
20
|
+
@script_file = options[:script] || '*.rb'
|
21
|
+
@show_methods = options[:show_methods]
|
22
|
+
@list = {}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieves the information about scripts and methods from the script directory
|
26
|
+
def execute
|
27
|
+
scripts = Dir.glob(File.join(@script_dir, @script_file))
|
28
|
+
scripts.each do |script|
|
29
|
+
list[script] = []
|
30
|
+
if show_methods
|
31
|
+
list[script] = retrieve_methods(script)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
list
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# Retrieve the methods including comments if available
|
40
|
+
def retrieve_methods(script)
|
41
|
+
code = File.read(script)
|
42
|
+
methods = code.scan(/((#.*\s)*def.*\s|def.*\s)/)
|
43
|
+
result = []
|
44
|
+
methods.each do |method|
|
45
|
+
result << method[0]
|
46
|
+
end
|
47
|
+
result
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/lib/sycsvpro/version.rb
CHANGED
data/lib/sycsvpro.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'sycsvpro/script_list'
|
2
|
+
|
3
|
+
module Sycsvpro
|
4
|
+
|
5
|
+
describe ScriptList do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@dir = File.join(File.dirname(__FILE__), "files")
|
9
|
+
@file_1 = File.join(File.dirname(__FILE__), "files/profile.rb")
|
10
|
+
@file_2 = File.join(File.dirname(__FILE__), "files/script.rb")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should list scripts" do
|
14
|
+
script_list = ScriptList.new(dir: @dir)
|
15
|
+
|
16
|
+
result = { @file_1 => [], @file_2 => [] }
|
17
|
+
|
18
|
+
script_list.execute.should eq result
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should list specified script" do
|
22
|
+
script_list = ScriptList.new(dir: @dir, script: "profile.rb")
|
23
|
+
|
24
|
+
result = { @file_1 => [] }
|
25
|
+
|
26
|
+
script_list.execute.should eq result
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should list specified script with methods" do
|
30
|
+
script_list = ScriptList.new(dir: @dir, script: "script.rb", show_methods: true)
|
31
|
+
|
32
|
+
result = {
|
33
|
+
@file_2 => ["# Reading and writing\n# a file\ndef read_write\n",
|
34
|
+
"def message\n",
|
35
|
+
"# Say hello\ndef say_hello\n"]
|
36
|
+
}
|
37
|
+
|
38
|
+
script_list.execute.should eq result
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should list all scripts with methods" do
|
43
|
+
script_list = ScriptList.new(dir: @dir, show_methods: true)
|
44
|
+
|
45
|
+
result = {
|
46
|
+
@file_1 => ["def calc\n"],
|
47
|
+
@file_2 => ["# Reading and writing\n# a file\ndef read_write\n",
|
48
|
+
"def message\n",
|
49
|
+
"# Say hello\ndef say_hello\n"]
|
50
|
+
}
|
51
|
+
|
52
|
+
script_list.execute.should eq result
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/sycsvpro.rdoc
CHANGED
@@ -7,7 +7,7 @@ SYNOPSIS
|
|
7
7
|
sycsvpro [global options] command [command options] [arguments...]
|
8
8
|
|
9
9
|
VERSION
|
10
|
-
0.0.
|
10
|
+
0.0.7
|
11
11
|
|
12
12
|
GLOBAL OPTIONS
|
13
13
|
-f, --file=FILE - CSV file to operate on (default: none)
|
@@ -27,4 +27,5 @@ COMMANDS
|
|
27
27
|
execute - Executes the code provided in a file
|
28
28
|
extract - Extract specified rows and columns from the file
|
29
29
|
help - Shows a list of commands or help for one command
|
30
|
+
list - List scripts in the scripts directory with optionally listing methods
|
30
31
|
map - Map values in columns to new values
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sycsvpro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Sugar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- html/Sycsvpro/Profiler.html
|
119
119
|
- html/Sycsvpro/RowFilter.html
|
120
120
|
- html/Sycsvpro/ScriptCreator.html
|
121
|
+
- html/Sycsvpro/ScriptList.html
|
121
122
|
- html/created.rid
|
122
123
|
- html/fonts.css
|
123
124
|
- html/fonts/Lato-Light.ttf
|
@@ -175,6 +176,7 @@ files:
|
|
175
176
|
- lib/sycsvpro/profiler.rb
|
176
177
|
- lib/sycsvpro/row_filter.rb
|
177
178
|
- lib/sycsvpro/script_creator.rb
|
179
|
+
- lib/sycsvpro/script_list.rb
|
178
180
|
- lib/sycsvpro/version.rb
|
179
181
|
- spec/sycsvpro/allocator_spec.rb
|
180
182
|
- spec/sycsvpro/analyze_spec.rb
|
@@ -184,8 +186,10 @@ files:
|
|
184
186
|
- spec/sycsvpro/extractor_spec.rb
|
185
187
|
- spec/sycsvpro/files/mappings
|
186
188
|
- spec/sycsvpro/files/profile.rb
|
189
|
+
- spec/sycsvpro/files/script.rb
|
187
190
|
- spec/sycsvpro/mapper_spec.rb
|
188
191
|
- spec/sycsvpro/profiler_spec.rb
|
192
|
+
- spec/sycsvpro/script_list_spec.rb
|
189
193
|
- sycsvpro.gemspec
|
190
194
|
- sycsvpro.rdoc
|
191
195
|
homepage: https://github.com/sugaryourcoffee/syc-svpro
|