censive 0.23 → 0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/censive.gemspec +1 -1
- data/lib/censive.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76c05b90f6a522a328f86d7d142ed150b33c487e74619707e10f40453c7e9079
|
4
|
+
data.tar.gz: 1e5a93d293ad708b323e20e1323926f2bf70e219ffc502e8fc87025be7be23b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e56b1a6a0f943d962ff8c240625a8354283fcbccd1a640cd66054873e1803779ddb36e128841590e8a8aa0022694e1e22a4fa25b6f88eba7056dc68b838262fb
|
7
|
+
data.tar.gz: 41ddfb9d77a686bef546836d0a110b9603ac7e4f205b7d9760ed37203d23f32f6ba9d2cc5fcb9f8996713fbcdec8fcb924298b1052c1ecc5e9f6442deed3078f
|
data/censive.gemspec
CHANGED
data/lib/censive.rb
CHANGED
@@ -153,6 +153,7 @@ class Censive < StringScanner
|
|
153
153
|
scan(@eoc) and break
|
154
154
|
@relax or bomb "invalid character after quote"
|
155
155
|
token << @quote + (scan_until(@quotes) or bomb "bad inline quote")
|
156
|
+
scan(@eoc) and break
|
156
157
|
end
|
157
158
|
scan(@sep)
|
158
159
|
@strip ? token.strip : token
|
@@ -190,7 +191,7 @@ class Censive < StringScanner
|
|
190
191
|
# returns 2 (must be quoted and escaped), 1 (must be quoted), 0 (neither)
|
191
192
|
def grok(str)
|
192
193
|
if idx = str.index(@escapes)
|
193
|
-
$1 ? 2 : str.index(@
|
194
|
+
$1 ? 2 : str.index(@quote, idx) ? 2 : 1
|
194
195
|
else
|
195
196
|
0
|
196
197
|
end
|
@@ -263,10 +264,13 @@ if __FILE__ == $0
|
|
263
264
|
# out = csv.export
|
264
265
|
# puts out.out
|
265
266
|
|
266
|
-
Censive.parse(str, excel: true, relax: true).to_csv
|
267
|
+
puts Censive.parse(str, excel: true, relax: true).to_csv
|
267
268
|
end
|
268
269
|
|
269
270
|
__END__
|
271
|
+
"AAA "BBB",CCC,"DDD"
|
272
|
+
|
273
|
+
"CHUI, LOK HANG "BENNY",224325325610,="001453","Hemoglobin A1c",=""
|
270
274
|
"Don",="007",10,"Ed"
|
271
275
|
Name,Age,,,Shoe,,,
|
272
276
|
"Alice",27,5
|
@@ -277,6 +281,8 @@ A,B,C,D
|
|
277
281
|
A,B,"C",D
|
278
282
|
A,B,C",D
|
279
283
|
A,B,"C",D
|
284
|
+
08/27/2022,="73859443",="04043260",,"Crossover @ Mathilda","CHO, JOELLE "JOJO"",08/19/2022
|
285
|
+
123,
|
280
286
|
123,"CHO, JOELLE "JOJO"",456
|
281
287
|
123,"CHO, JOELLE ""JOJO""",456
|
282
288
|
=,=x,x=,="x",="","","=",123,0123,="123",="0123"
|