cocos 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/cocos/version.rb +1 -1
- data/lib/cocos.rb +35 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbe9c2c739403b5996adda6684d175a3853afbd76bffe81adf44c8a31cbe0c8d
|
4
|
+
data.tar.gz: 4ba46909cd0722c656aaa1be7145dc5430e681bf5f4722e2b03b3af6928d9de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5416f8ad167ba3f614cb85483b372bd1b9a8ccf7c60a69fcdbcfac954c1ae3c586f582e1fa3d7abf6dc6cf4c3f95c1da0f8e2bbfaae12b716d77290f90450715
|
7
|
+
data.tar.gz: e7aa4a8514cf702b9b35b526e60011743de51ebdf1cbb2e8e0861e722225b5e3e76b113304dbcb8c58c377be17e340fd0e961a64a8a3a568768d01fe17a6de3e
|
data/CHANGELOG.md
CHANGED
data/lib/cocos/version.rb
CHANGED
data/lib/cocos.rb
CHANGED
@@ -271,6 +271,41 @@ alias_method :write_txt, :write_text
|
|
271
271
|
|
272
272
|
|
273
273
|
|
274
|
+
#
|
275
|
+
# note:
|
276
|
+
# for now write_csv expects array of string arrays
|
277
|
+
# does NOT support array of hashes for now
|
278
|
+
|
279
|
+
def write_csv( path, recs, headers: nil )
|
280
|
+
dirname = File.dirname( path )
|
281
|
+
FileUtils.mkdir_p( dirname ) unless Dir.exist?( dirname )
|
282
|
+
|
283
|
+
File.open( path, 'w:utf-8' ) do |f|
|
284
|
+
if headers
|
285
|
+
f.write( headers.join(',')) ## e.g. Date,Team 1,FT,HT,Team 2
|
286
|
+
f.write( "\n" )
|
287
|
+
end
|
288
|
+
|
289
|
+
recs.each do |values|
|
290
|
+
## quote values that incl. a comma
|
291
|
+
## todo/fix - add more escape/quote checks - why? why not?
|
292
|
+
## check how other csv libs handle value generation
|
293
|
+
buf = values.map do |value|
|
294
|
+
if value.index(',')
|
295
|
+
%Q{"#{value}"}
|
296
|
+
else
|
297
|
+
value
|
298
|
+
end
|
299
|
+
end.join( ',' )
|
300
|
+
|
301
|
+
f.write( buf )
|
302
|
+
f.write( "\n" )
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
|
274
309
|
######
|
275
310
|
# world wide web (www) support
|
276
311
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: csvreader
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '4.
|
95
|
+
version: '4.1'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '4.
|
102
|
+
version: '4.1'
|
103
103
|
description: cocos (code commons) - auto-include quick-starter prelude & prolog
|
104
104
|
email: opensport@googlegroups.com
|
105
105
|
executables: []
|