sycsvpro 0.0.5 → 0.0.6
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 +4 -4
- data/README.md +8 -1
- data/bin/sycsvpro +120 -33
- data/html/Sycsvpro/ScriptCreator.html +221 -0
- data/html/Sycsvpro.html +2 -0
- data/html/created.rid +4 -3
- data/html/index.html +2 -0
- data/html/js/search_index.js +1 -1
- data/html/table_of_contents.html +31 -23
- data/lib/sycsvpro/script_creator.rb +51 -0
- data/lib/sycsvpro/version.rb +1 -1
- data/lib/sycsvpro.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59be0284b8527763bc36dedfd9aeaeb3ba5284f1
|
4
|
+
data.tar.gz: 21ae122696a00cc5dc09609493ef6f53385fb819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917467f20b0616376523e9eb6475ab46d2d83b0ad61ae31c212332156876208c4c86214d17f0278dad46e8e14636ca6fc54176841e229ed8ac2e8067535339dd
|
7
|
+
data.tar.gz: 20c42430c7cc6166e7efb018b284d2fb5b2dbd3de57f7584302a687bd8f915b45c1c9f484289b91ee06c5fc55f4fc894b9eed2a7c6613d0a1ebb6c8de0691428
|
data/README.md
CHANGED
@@ -10,7 +10,8 @@ Processing of csv files. *sycsvpro* offers following functions
|
|
10
10
|
* allocate column values to a key column (since version 0.0.4)
|
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
|
+
* execute a Ruby script file that operates a csv file
|
14
15
|
|
15
16
|
To get help type
|
16
17
|
|
@@ -137,6 +138,12 @@ Process arithmetic operations on the contract count and create a target column
|
|
137
138
|
chiro;c1;con333;dri110;mot100;1.12.3013;2;20
|
138
139
|
chiro;c2;con331;dri100;mot130;1.12.3013;2;20
|
139
140
|
|
141
|
+
Edit
|
142
|
+
----
|
143
|
+
Creates or if it exists opens a file for editing. The file is created in the directory ~/.syc/sycsvpro/scripts. Following command creates a Ruby script with the name script.rb and a method call_me
|
144
|
+
|
145
|
+
$ sycsvpro edit -s script.rb -m call_me
|
146
|
+
|
140
147
|
Execute
|
141
148
|
-------
|
142
149
|
|
data/bin/sycsvpro
CHANGED
@@ -11,6 +11,16 @@ end
|
|
11
11
|
|
12
12
|
include GLI::App
|
13
13
|
|
14
|
+
# Directory holding configuration files
|
15
|
+
sycsvpro_directory = File.expand_path("~/.syc/sycsvpro")
|
16
|
+
|
17
|
+
unless File.exists? sycsvpro_directory
|
18
|
+
Dir.mkdir sycsvpro_directory
|
19
|
+
end
|
20
|
+
|
21
|
+
# Script directory
|
22
|
+
script_directory = File.join(sycsvpro_directory, "scripts")
|
23
|
+
|
14
24
|
program_desc 'Processing CSV files'
|
15
25
|
|
16
26
|
version Sycsvpro::VERSION
|
@@ -27,9 +37,10 @@ desc 'Analyze the CSV file regarding columns, rows and content'
|
|
27
37
|
command :analyze do |c|
|
28
38
|
|
29
39
|
c.action do |global_options,options,args|
|
30
|
-
|
40
|
+
print "Analyzing..."
|
31
41
|
analyzer = Sycsvpro::Analyzer.new(global_options[:f])
|
32
42
|
result = analyzer.result
|
43
|
+
puts "done"
|
33
44
|
puts "Analysis of #{global_options[:f]}"
|
34
45
|
puts "#{result.col_count} columns: #{result.cols}"
|
35
46
|
puts "#{result.row_count} rows"
|
@@ -52,14 +63,11 @@ command :extract do |c|
|
|
52
63
|
c.flag [:c, :col], :must_match => /\d+(?:,\d+|-\d+)*/
|
53
64
|
|
54
65
|
c.action do |global_options,options,args|
|
55
|
-
|
56
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
57
|
-
|
58
|
-
puts "Extracting ..."
|
66
|
+
print "Extracting ..."
|
59
67
|
extractor = Sycsvpro::Extractor.new(infile: global_options[:f], outfile: global_options[:o],
|
60
68
|
rows: options[:r], cols: options[:c])
|
61
69
|
extractor.execute
|
62
|
-
puts "
|
70
|
+
puts "done"
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
@@ -75,14 +83,11 @@ command :collect do |c|
|
|
75
83
|
c.flag [:c, :col], :must_match => /^\w*:\d+(?:,\d+|-\d+|\+\w*:\d+(?:,\d+|-\d+)*)*/
|
76
84
|
|
77
85
|
c.action do |global_options,options,args|
|
78
|
-
|
79
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
80
|
-
|
81
|
-
puts "Collecting ..."
|
86
|
+
print "Collecting ..."
|
82
87
|
collector = Sycsvpro::Collector.new(infile: global_options[:f], outfile: global_options[:o],
|
83
88
|
rows: options[:r], cols: options[:c])
|
84
89
|
collector.execute
|
85
|
-
puts "
|
90
|
+
puts "done"
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
@@ -101,14 +106,29 @@ command :allocate do |c|
|
|
101
106
|
c.flag [:c, :col], :must_match => /\d+(?:,\d+|-\d+)*/
|
102
107
|
|
103
108
|
c.action do |global_options,options,args|
|
104
|
-
|
105
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
106
|
-
|
107
|
-
puts "Allocating ..."
|
109
|
+
print "Allocating ..."
|
108
110
|
allocator = Sycsvpro::Allocator.new(infile: global_options[:f], outfile: global_options[:o],
|
109
111
|
key: options[:k], rows: options[:r], cols: options[:c])
|
110
112
|
allocator.execute
|
111
|
-
puts "
|
113
|
+
puts "done"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
desc 'Creates a script file or opens a script file for editing if it exists'
|
118
|
+
command :edit do |c|
|
119
|
+
c.desc 'Name of the script file'
|
120
|
+
c.default_value 'script.rb'
|
121
|
+
c.arg_name 'SCRIPT_NAME.rb'
|
122
|
+
c.flag [:s, :script], :must_match => /^\w+\.rb/
|
123
|
+
|
124
|
+
c.desc 'Method to create'
|
125
|
+
c.arg_name 'METHOD_NAME'
|
126
|
+
c.flag [:m, :method], :must_match => /^\w+/
|
127
|
+
|
128
|
+
c.action do |global_options,options,args|
|
129
|
+
script_creator = Sycsvpro::ScriptCreator.new(dir: sycsvpro_directory,
|
130
|
+
script: options[:s], method: options[:m])
|
131
|
+
system "vi #{script_creator.script_file}"
|
112
132
|
end
|
113
133
|
end
|
114
134
|
|
@@ -117,10 +137,15 @@ arg_name 'PRO_FILE METHOD'
|
|
117
137
|
command :execute do |c|
|
118
138
|
c.action do |global_options,options,args|
|
119
139
|
help_now! "You need to provide a script FILE and a METHOD to call" if args.size < 2
|
120
|
-
|
121
|
-
|
140
|
+
|
141
|
+
script_file = File.expand_path(args[0])
|
142
|
+
script_file = File.join(script_directory, args[0]) unless File.exists? script_file
|
143
|
+
help_now! "Script file #{script_file} doesn't exist!" unless File.exists? script_file
|
144
|
+
|
145
|
+
print "Executing..."
|
146
|
+
profiler = Sycsvpro::Profiler.new(script_file)
|
122
147
|
profiler.execute(args[1])
|
123
|
-
puts "
|
148
|
+
puts "done"
|
124
149
|
end
|
125
150
|
end
|
126
151
|
|
@@ -151,15 +176,12 @@ command :count do |c|
|
|
151
176
|
c.flag [:df]
|
152
177
|
|
153
178
|
c.action do |global_options,options,args|
|
154
|
-
|
155
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
156
|
-
|
157
|
-
puts "Counting..."
|
179
|
+
print "Counting..."
|
158
180
|
counter = Sycsvpro::Counter.new(infile: global_options[:f], outfile: global_options[:o],
|
159
181
|
key: options[:k], rows: options[:r], cols: options[:c],
|
160
182
|
df: options[:df], sum: options[:s])
|
161
183
|
counter.execute
|
162
|
-
puts "
|
184
|
+
puts "done"
|
163
185
|
end
|
164
186
|
end
|
165
187
|
|
@@ -175,21 +197,18 @@ command :map do |c|
|
|
175
197
|
c.flag [:c, :col], :must_match => /\d+(?:,\d+|-\d+)*/
|
176
198
|
|
177
199
|
c.action do |global_options,options,args|
|
178
|
-
help_now! "You need to provide a file to map data from '-f FILE'" if global_options[:f].nil?
|
179
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
180
200
|
help_now! "You need to provide a mapping file" if args.size == 0
|
181
201
|
|
182
|
-
|
202
|
+
print "Mapping..."
|
183
203
|
mapper = Sycsvpro::Mapper.new(infile: global_options[:f], outfile: global_options[:o],
|
184
204
|
mapping: args[0], rows: options[:r], cols: options[:c])
|
185
205
|
mapper.execute
|
186
|
-
puts "
|
206
|
+
puts "done"
|
187
207
|
end
|
188
208
|
end
|
189
209
|
|
190
210
|
desc 'Process math operations on columns'
|
191
211
|
command :calc do |c|
|
192
|
-
|
193
212
|
c.desc 'The first non-empty column is considered the header. '+
|
194
213
|
'If additional columns are created then *,COL1,COL2 will create the additional header '+
|
195
214
|
'columns COL1 and COL2'
|
@@ -206,15 +225,13 @@ command :calc do |c|
|
|
206
225
|
c.flag [:c, :col], :must_match => /\d+:(?:[\*\/\+\-]|\w+=[\d|(]*)[\*\/\+\-\dc()]*(?:,\d+:(?:[\*\/\+\-]|\w+=[\d|(]*)[\*\/\+\-\dc()]*)*/
|
207
226
|
|
208
227
|
c.action do |global_options,options,args|
|
209
|
-
help_now! "You need to provide a file to calculate data at '-f FILE'" if global_options[:f].nil?
|
210
|
-
help_now! "You need to provide a result file '-o OUT_FILE'" if global_options[:o].nil?
|
211
228
|
help_now! "You need to provide the column flag" if options[:c].nil?
|
212
229
|
|
213
|
-
|
230
|
+
print "Calculating..."
|
214
231
|
calculator = Sycsvpro::Calculator.new(infile: global_options[:f], outfile: global_options[:o],
|
215
232
|
header: options[:h], rows: options[:r], cols: options[:c])
|
216
233
|
calculator.execute
|
217
|
-
puts "
|
234
|
+
puts "done"
|
218
235
|
end
|
219
236
|
end
|
220
237
|
|
@@ -224,6 +241,67 @@ pre do |global,command,options,args|
|
|
224
241
|
# chosen command
|
225
242
|
# Use skips_pre before a command to skip this block
|
226
243
|
# on that command only
|
244
|
+
|
245
|
+
case command.name
|
246
|
+
when :analyze
|
247
|
+
help_now! "You need to provide an input file '-f FILE'" if global[:f].nil?
|
248
|
+
when :allocate, :calc, :collect, :count, :extract, :map
|
249
|
+
help_now! "You need to provide an input file '-f FILE'" if global[:f].nil?
|
250
|
+
help_now! "You need to provide a result file '-o OUT_FILE'" if global[:o].nil?
|
251
|
+
end
|
252
|
+
|
253
|
+
count = 0
|
254
|
+
|
255
|
+
unless command.name == :edit or command.name == :execute
|
256
|
+
analyzer = Sycsvpro::Analyzer.new(global[:f])
|
257
|
+
result = analyzer.result
|
258
|
+
count = result.row_count
|
259
|
+
end
|
260
|
+
|
261
|
+
Stats = Struct.new(:command, :start, :end, :count) do
|
262
|
+
def duration
|
263
|
+
self.end - self.start
|
264
|
+
end
|
265
|
+
|
266
|
+
def average
|
267
|
+
if count > 0
|
268
|
+
(self.end - self.start) * 1000 / self.count
|
269
|
+
else
|
270
|
+
0
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def to_s
|
275
|
+
if count > 0
|
276
|
+
sprintf("%s %g %s %d %s %g %s", "'#{self.command}' has run",
|
277
|
+
duration,
|
278
|
+
"seconds to operate",
|
279
|
+
self.count,
|
280
|
+
"rows -",
|
281
|
+
average,
|
282
|
+
"ms per row")
|
283
|
+
else
|
284
|
+
sprintf("%s %g %s %d %s", "'#{self.command}' has run",
|
285
|
+
duration,
|
286
|
+
"seconds to operate",
|
287
|
+
self.count,
|
288
|
+
"rows")
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
@stats = Stats.new(command.name, Time.now, Time.now, count)
|
294
|
+
|
295
|
+
unless command.name == :edit
|
296
|
+
progress = Thread.new do
|
297
|
+
sleep 3
|
298
|
+
while true
|
299
|
+
print '.'
|
300
|
+
sleep 1
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
227
305
|
true
|
228
306
|
end
|
229
307
|
|
@@ -231,6 +309,15 @@ post do |global,command,options,args|
|
|
231
309
|
# Post logic here
|
232
310
|
# Use skips_post before a command to skip this
|
233
311
|
# block on that command only
|
312
|
+
puts
|
313
|
+
print "-> "
|
314
|
+
|
315
|
+
@stats.end = Time.now
|
316
|
+
unless command.name == :edit or command.name == :execute
|
317
|
+
puts @stats
|
318
|
+
else
|
319
|
+
puts @stats if command.name == :execute
|
320
|
+
end
|
234
321
|
end
|
235
322
|
|
236
323
|
on_error do |exception|
|
@@ -0,0 +1,221 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Sycsvpro::ScriptCreator - 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
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<main role="main" aria-labelledby="class-Sycsvpro::ScriptCreator">
|
85
|
+
<h1 id="class-Sycsvpro::ScriptCreator" class="class">
|
86
|
+
class Sycsvpro::ScriptCreator
|
87
|
+
</h1>
|
88
|
+
|
89
|
+
<section class="description">
|
90
|
+
|
91
|
+
<p>Creates a ruby script scaffold</p>
|
92
|
+
|
93
|
+
</section>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<section class="attribute-method-details" class="method-section">
|
107
|
+
<header>
|
108
|
+
<h3>Attributes</h3>
|
109
|
+
</header>
|
110
|
+
|
111
|
+
|
112
|
+
<div id="attribute-i-dir" class="method-detail">
|
113
|
+
<div class="method-heading attribute-method-heading">
|
114
|
+
<span class="method-name">dir</span><span
|
115
|
+
class="attribute-access-type">[R]</span>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div class="method-description">
|
119
|
+
|
120
|
+
<p>Directory of the script files</p>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
<div id="attribute-i-method_name" class="method-detail">
|
126
|
+
<div class="method-heading attribute-method-heading">
|
127
|
+
<span class="method-name">method_name</span><span
|
128
|
+
class="attribute-access-type">[R]</span>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div class="method-description">
|
132
|
+
|
133
|
+
<p>Method name</p>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div id="attribute-i-script_file" class="method-detail">
|
139
|
+
<div class="method-heading attribute-method-heading">
|
140
|
+
<span class="method-name">script_file</span><span
|
141
|
+
class="attribute-access-type">[R]</span>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="method-description">
|
145
|
+
|
146
|
+
<p><a href="ScriptCreator.html#attribute-i-script_file">#script_file</a> path</p>
|
147
|
+
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div id="attribute-i-script_name" class="method-detail">
|
152
|
+
<div class="method-heading attribute-method-heading">
|
153
|
+
<span class="method-name">script_name</span><span
|
154
|
+
class="attribute-access-type">[R]</span>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
|
159
|
+
<p>Script name</p>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
</section>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
169
|
+
<header>
|
170
|
+
<h3>Public Class Methods</h3>
|
171
|
+
</header>
|
172
|
+
|
173
|
+
|
174
|
+
<div id="method-c-new" class="method-detail ">
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
<span class="method-name">new</span><span
|
178
|
+
class="method-args">(options={})</span>
|
179
|
+
|
180
|
+
<span class="method-click-advice">click to toggle source</span>
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
|
187
|
+
<p>Creates a new <a href="ScriptCreator.html">ScriptCreator</a></p>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<div class="method-source-code" id="new-source">
|
193
|
+
<pre><span class="ruby-comment"># File lib/sycsvpro/script_creator.rb, line 17</span>
|
194
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
|
195
|
+
<span class="ruby-ivar">@dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:dir</span>], <span class="ruby-string">'scripts'</span>)
|
196
|
+
<span class="ruby-ivar">@script_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:script</span>]
|
197
|
+
<span class="ruby-ivar">@method_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:method</span>]
|
198
|
+
<span class="ruby-identifier">create_script</span>
|
199
|
+
<span class="ruby-keyword">end</span></pre>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
|
210
|
+
</section>
|
211
|
+
|
212
|
+
</section>
|
213
|
+
</main>
|
214
|
+
|
215
|
+
|
216
|
+
<footer id="validator-badges" role="contentinfo">
|
217
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
218
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
219
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
220
|
+
</footer>
|
221
|
+
|
data/html/Sycsvpro.html
CHANGED
data/html/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Fri, 21 Feb 2014
|
1
|
+
Fri, 21 Feb 2014 22:50:15 +0100
|
2
2
|
README.rdoc Sun, 16 Feb 2014 22:01:46 +0100
|
3
|
-
lib/sycsvpro.rb
|
3
|
+
lib/sycsvpro.rb Fri, 21 Feb 2014 22:22:32 +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
|
@@ -14,5 +14,6 @@ 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
|
+
lib/sycsvpro/script_creator.rb Fri, 21 Feb 2014 22:42:17 +0100
|
17
18
|
lib/sycsvpro/version.rb Fri, 21 Feb 2014 21:22:36 +0100
|
18
|
-
bin/sycsvpro Fri, 21 Feb 2014
|
19
|
+
bin/sycsvpro Fri, 21 Feb 2014 22:47:07 +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","execute()","execute()","execute()","execute()","execute()","execute()","execute()","has_filter?()","method_missing()","method_missing()","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::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::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"],["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"],["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","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"]]}}
|
data/html/table_of_contents.html
CHANGED
@@ -88,6 +88,9 @@
|
|
88
88
|
<li class="class">
|
89
89
|
<a href="Sycsvpro/RowFilter.html">Sycsvpro::RowFilter</a>
|
90
90
|
</li>
|
91
|
+
<li class="class">
|
92
|
+
<a href="Sycsvpro/ScriptCreator.html">Sycsvpro::ScriptCreator</a>
|
93
|
+
</li>
|
91
94
|
</ul>
|
92
95
|
|
93
96
|
<h2 id="methods">Methods</h2>
|
@@ -99,9 +102,9 @@
|
|
99
102
|
<span class="container">Sycsvpro::Allocator</span>
|
100
103
|
|
101
104
|
<li class="method">
|
102
|
-
<a href="Sycsvpro/
|
105
|
+
<a href="Sycsvpro/ScriptCreator.html#method-c-new">::new</a>
|
103
106
|
—
|
104
|
-
<span class="container">Sycsvpro::
|
107
|
+
<span class="container">Sycsvpro::ScriptCreator</span>
|
105
108
|
|
106
109
|
<li class="method">
|
107
110
|
<a href="Sycsvpro/Analyzer.html#method-c-new">::new</a>
|
@@ -109,9 +112,9 @@
|
|
109
112
|
<span class="container">Sycsvpro::Analyzer</span>
|
110
113
|
|
111
114
|
<li class="method">
|
112
|
-
<a href="Sycsvpro/
|
115
|
+
<a href="Sycsvpro/Profiler.html#method-c-new">::new</a>
|
113
116
|
—
|
114
|
-
<span class="container">Sycsvpro::
|
117
|
+
<span class="container">Sycsvpro::Profiler</span>
|
115
118
|
|
116
119
|
<li class="method">
|
117
120
|
<a href="Sycsvpro/Calculator.html#method-c-new">::new</a>
|
@@ -119,14 +122,14 @@
|
|
119
122
|
<span class="container">Sycsvpro::Calculator</span>
|
120
123
|
|
121
124
|
<li class="method">
|
122
|
-
<a href="Sycsvpro/
|
125
|
+
<a href="Sycsvpro/Mapper.html#method-c-new">::new</a>
|
123
126
|
—
|
124
|
-
<span class="container">Sycsvpro::
|
127
|
+
<span class="container">Sycsvpro::Mapper</span>
|
125
128
|
|
126
129
|
<li class="method">
|
127
|
-
<a href="Sycsvpro/
|
130
|
+
<a href="Sycsvpro/Header.html#method-c-new">::new</a>
|
128
131
|
—
|
129
|
-
<span class="container">Sycsvpro::
|
132
|
+
<span class="container">Sycsvpro::Header</span>
|
130
133
|
|
131
134
|
<li class="method">
|
132
135
|
<a href="Sycsvpro/Collector.html#method-c-new">::new</a>
|
@@ -139,14 +142,14 @@
|
|
139
142
|
<span class="container">Sycsvpro::Counter</span>
|
140
143
|
|
141
144
|
<li class="method">
|
142
|
-
<a href="Sycsvpro/
|
145
|
+
<a href="Sycsvpro/Extractor.html#method-c-new">::new</a>
|
143
146
|
—
|
144
|
-
<span class="container">Sycsvpro::
|
147
|
+
<span class="container">Sycsvpro::Extractor</span>
|
145
148
|
|
146
149
|
<li class="method">
|
147
|
-
<a href="Sycsvpro/
|
150
|
+
<a href="Sycsvpro/Filter.html#method-c-new">::new</a>
|
148
151
|
—
|
149
|
-
<span class="container">Sycsvpro::
|
152
|
+
<span class="container">Sycsvpro::Filter</span>
|
150
153
|
|
151
154
|
<li class="method">
|
152
155
|
<a href="Sycsvpro/Counter.html#method-i-execute">#execute</a>
|
@@ -154,9 +157,9 @@
|
|
154
157
|
<span class="container">Sycsvpro::Counter</span>
|
155
158
|
|
156
159
|
<li class="method">
|
157
|
-
<a href="Sycsvpro/
|
160
|
+
<a href="Sycsvpro/Allocator.html#method-i-execute">#execute</a>
|
158
161
|
—
|
159
|
-
<span class="container">Sycsvpro::
|
162
|
+
<span class="container">Sycsvpro::Allocator</span>
|
160
163
|
|
161
164
|
<li class="method">
|
162
165
|
<a href="Sycsvpro/Profiler.html#method-i-execute">#execute</a>
|
@@ -164,9 +167,14 @@
|
|
164
167
|
<span class="container">Sycsvpro::Profiler</span>
|
165
168
|
|
166
169
|
<li class="method">
|
167
|
-
<a href="Sycsvpro/
|
170
|
+
<a href="Sycsvpro/Mapper.html#method-i-execute">#execute</a>
|
168
171
|
—
|
169
|
-
<span class="container">Sycsvpro::
|
172
|
+
<span class="container">Sycsvpro::Mapper</span>
|
173
|
+
|
174
|
+
<li class="method">
|
175
|
+
<a href="Sycsvpro/Extractor.html#method-i-execute">#execute</a>
|
176
|
+
—
|
177
|
+
<span class="container">Sycsvpro::Extractor</span>
|
170
178
|
|
171
179
|
<li class="method">
|
172
180
|
<a href="Sycsvpro/Collector.html#method-i-execute">#execute</a>
|
@@ -174,9 +182,9 @@
|
|
174
182
|
<span class="container">Sycsvpro::Collector</span>
|
175
183
|
|
176
184
|
<li class="method">
|
177
|
-
<a href="Sycsvpro/
|
185
|
+
<a href="Sycsvpro/Calculator.html#method-i-execute">#execute</a>
|
178
186
|
—
|
179
|
-
<span class="container">Sycsvpro::
|
187
|
+
<span class="container">Sycsvpro::Calculator</span>
|
180
188
|
|
181
189
|
<li class="method">
|
182
190
|
<a href="Sycsvpro/Filter.html#method-i-has_filter-3F">#has_filter?</a>
|
@@ -203,11 +211,6 @@
|
|
203
211
|
—
|
204
212
|
<span class="container">Sycsvpro::Filter</span>
|
205
213
|
|
206
|
-
<li class="method">
|
207
|
-
<a href="Sycsvpro/Header.html#method-i-process">#process</a>
|
208
|
-
—
|
209
|
-
<span class="container">Sycsvpro::Header</span>
|
210
|
-
|
211
214
|
<li class="method">
|
212
215
|
<a href="Sycsvpro/RowFilter.html#method-i-process">#process</a>
|
213
216
|
—
|
@@ -218,6 +221,11 @@
|
|
218
221
|
—
|
219
222
|
<span class="container">Sycsvpro::ColumnFilter</span>
|
220
223
|
|
224
|
+
<li class="method">
|
225
|
+
<a href="Sycsvpro/Header.html#method-i-process">#process</a>
|
226
|
+
—
|
227
|
+
<span class="container">Sycsvpro::Header</span>
|
228
|
+
|
221
229
|
<li class="method">
|
222
230
|
<a href="Sycsvpro/Counter.html#method-i-process_file">#process_file</a>
|
223
231
|
—
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Operating csv files
|
2
|
+
module Sycsvpro
|
3
|
+
|
4
|
+
# Creates a ruby script scaffold
|
5
|
+
class ScriptCreator
|
6
|
+
|
7
|
+
# Directory of the script files
|
8
|
+
attr_reader :dir
|
9
|
+
# Script name
|
10
|
+
attr_reader :script_name
|
11
|
+
# Method name
|
12
|
+
attr_reader :method_name
|
13
|
+
# script_file path
|
14
|
+
attr_reader :script_file
|
15
|
+
|
16
|
+
# Creates a new ScriptCreator
|
17
|
+
def initialize(options={})
|
18
|
+
@dir = File.join(options[:dir], 'scripts')
|
19
|
+
@script_name = options[:script]
|
20
|
+
@method_name = options[:method]
|
21
|
+
create_script
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Creates a script file if it doesn't exist and adds an empty method with the provided
|
27
|
+
# method name. When file exists and method name is provided the method is appended to the
|
28
|
+
# existing file. Note: it is not checked whether method name already exists.
|
29
|
+
def create_script
|
30
|
+
Dir.mkdir dir unless File.exists? dir
|
31
|
+
@script_file = File.join(dir, script_name)
|
32
|
+
unless File.exists? @script_file
|
33
|
+
File.open(@script_file, 'w') do |f|
|
34
|
+
f.print "def "
|
35
|
+
f.puts "#{method_name}" if method_name
|
36
|
+
f.puts "end"
|
37
|
+
end
|
38
|
+
else
|
39
|
+
if method_name
|
40
|
+
File.open(@script_file, 'a') do |f|
|
41
|
+
f.puts
|
42
|
+
f.puts "def #{method_name}"
|
43
|
+
f.puts "end"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/lib/sycsvpro/version.rb
CHANGED
data/lib/sycsvpro.rb
CHANGED
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.6
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- html/Sycsvpro/Mapper.html
|
118
118
|
- html/Sycsvpro/Profiler.html
|
119
119
|
- html/Sycsvpro/RowFilter.html
|
120
|
+
- html/Sycsvpro/ScriptCreator.html
|
120
121
|
- html/created.rid
|
121
122
|
- html/fonts.css
|
122
123
|
- html/fonts/Lato-Light.ttf
|
@@ -173,6 +174,7 @@ files:
|
|
173
174
|
- lib/sycsvpro/mapper.rb
|
174
175
|
- lib/sycsvpro/profiler.rb
|
175
176
|
- lib/sycsvpro/row_filter.rb
|
177
|
+
- lib/sycsvpro/script_creator.rb
|
176
178
|
- lib/sycsvpro/version.rb
|
177
179
|
- spec/sycsvpro/allocator_spec.rb
|
178
180
|
- spec/sycsvpro/analyze_spec.rb
|