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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38e913cc7ec8d6951edd7bb59ac80626aadf3a3fbd7b13f82ccc123dffc6a7b1
4
- data.tar.gz: 8883a9656f7aa48b6c778e9786966f507a80dbd13be670ca69ff9ed5b20656a8
3
+ metadata.gz: cbe9c2c739403b5996adda6684d175a3853afbd76bffe81adf44c8a31cbe0c8d
4
+ data.tar.gz: 4ba46909cd0722c656aaa1be7145dc5430e681bf5f4722e2b03b3af6928d9de8
5
5
  SHA512:
6
- metadata.gz: 1b9e85de98ce029a384d0ce1fa2e09905d3d7eeee956d59ab090c0eb9300b1de121ecc1bfeaaacdebdca7dd66227f7a9fefce1ef397d1d97fa5123cac32609c8
7
- data.tar.gz: ba6fc944c1dc724c131c0f32390349140c3d658a4db80d876a421704eea1d13ac78ecedc3da6141ba7116367270e836d8aafcb420b12bd664ae604ac557af8a4
6
+ metadata.gz: 5416f8ad167ba3f614cb85483b372bd1b9a8ccf7c60a69fcdbcfac954c1ae3c586f582e1fa3d7abf6dc6cf4c3f95c1da0f8e2bbfaae12b716d77290f90450715
7
+ data.tar.gz: e7aa4a8514cf702b9b35b526e60011743de51ebdf1cbb2e8e0861e722225b5e3e76b113304dbcb8c58c377be17e340fd0e961a64a8a3a568768d01fe17a6de3e
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.3.0
1
+ ### 0.3.1
2
2
  ### 0.0.1 / 2022-08-01
3
3
 
4
4
  * Everything is new. First release.
data/lib/cocos/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module Cocos
3
3
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
4
  MINOR = 3
5
- PATCH = 0
5
+ PATCH = 1
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
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.0
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: 2023-09-05 00:00:00.000000000 Z
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.0'
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.0'
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: []