censive 0.29 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/censive.rb +41 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 246be731b3c88020be3432707b0fb66b8624bc6ebd18b54dae56d813defc7ae9
|
4
|
+
data.tar.gz: 13ee5d519f07b82c410a1afcdeaf01678be8e43de894b00e7d6a1bab09e9cf92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a36473da2784c22dd99a4a414388699942d2bcfcbe87d3883f4efa4234922d99db4aa359102f9f56ae2d94d162d7391ca8caffdbaf3cf550f8a50a00b7b19fc5
|
7
|
+
data.tar.gz: 27a07ae5bbcc85c5b48116b935cdd62d39d1b34bf66abf31ab255ab7562ee0fdd1ad44a42990387ee0057a5423175e00117de98c9484564b65e4baea2fda415a
|
data/lib/censive.rb
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
require "strscan"
|
29
29
|
|
30
30
|
class Censive < StringScanner
|
31
|
-
VERSION="0.
|
31
|
+
VERSION="1.0.0"
|
32
32
|
|
33
33
|
attr :encoding, :out, :rows
|
34
34
|
|
@@ -220,7 +220,7 @@ class Censive < StringScanner
|
|
220
220
|
row
|
221
221
|
when 1
|
222
222
|
row.map do |col|
|
223
|
-
col
|
223
|
+
col&.match?(@quotable) ? "#{q}#{col}#{q}" : col
|
224
224
|
end
|
225
225
|
else
|
226
226
|
row.map do |col|
|
@@ -257,3 +257,42 @@ class Censive < StringScanner
|
|
257
257
|
abort "\n#{File.basename($0)}: #{msg} at character #{pos} near '#{string[pos-4,7]}'"
|
258
258
|
end
|
259
259
|
end
|
260
|
+
|
261
|
+
if __FILE__ == $0
|
262
|
+
str = DATA.gets("\n\n").chomp
|
263
|
+
# str = File.read(ARGV.first || "lc-2023.csv")
|
264
|
+
# str = File.open("KEN_ALL.CSV", "r:cp932").read
|
265
|
+
|
266
|
+
# require "stringio"
|
267
|
+
# csv = Censive.new(str, excel: true, relax: true)
|
268
|
+
# out = "" # StringIO.new
|
269
|
+
# csv.export(out: out) # (excel: true) # sep: "|")
|
270
|
+
# puts out # .string
|
271
|
+
|
272
|
+
# csv = Censive.new(str, excel: true, relax: true, out: "")
|
273
|
+
# out = csv.export
|
274
|
+
# puts out.out
|
275
|
+
|
276
|
+
puts Censive.parse(str, excel: true, relax: true).to_csv
|
277
|
+
end
|
278
|
+
|
279
|
+
__END__
|
280
|
+
"AAA "BBB",CCC,"DDD"
|
281
|
+
|
282
|
+
"CHUI, LOK HANG "BENNY",224325325610,="001453","Hemoglobin A1c",=""
|
283
|
+
"Don",="007",10,"Ed"
|
284
|
+
Name,Age,,,Shoe,,,
|
285
|
+
"Alice",27,5
|
286
|
+
Bob,33,10 1/2
|
287
|
+
Charlie or "Chuck",=B2 + B3,9
|
288
|
+
Subtotal,=sum(B2:B5),="01234"
|
289
|
+
A,B,C,D
|
290
|
+
A,B,"C",D
|
291
|
+
A,B,C",D
|
292
|
+
A,B,"C",D
|
293
|
+
08/27/2022,="73859443",="04043260",,"Crossover @ Mathilda","CHO, JOELLE "JOJO"",08/19/2022
|
294
|
+
123,
|
295
|
+
123,"CHO, JOELLE "JOJO"",456
|
296
|
+
123,"CHO, JOELLE ""JOJO""",456
|
297
|
+
=,=x,x=,="x",="","","=",123,0123,="123",="0123"
|
298
|
+
,=x,x=,x,,,,,,=,,123,="0123",123,,="0123"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: censive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A quick and lightweight CSV handling library for Ruby
|
14
14
|
email: steve.shreeve@gmail.com
|
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
|
-
rubygems_version: 3.4.
|
50
|
+
rubygems_version: 3.4.10
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: A quick and lightweight CSV handling library for Ruby
|