censive 1.0.1 → 1.0.3
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 +5 -4
- 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: 6b3192a24670593887dbf1e955c2db44c912248b4eef81c2f89d411190ff7a7c
|
4
|
+
data.tar.gz: f95e5e02f4930f8478fa0bae557e13f72d93637e7bb1d4458a6fa46e022f76cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38405a381813ba7d8f575b654c1593f3e0cf7d3869258f8956c5631ac8887e78a292bb7838773af9ea6b42590fd28d4aa4f2b654d4caa5c60f24470bd7df3c4e
|
7
|
+
data.tar.gz: 85168aaaf282d7a273068c906cd98347f91ada39daa8e9d7967dce23796e9ab632ea62d1be9ad0ade55dd01de9865eeff1afdccc571199cb23ff6b2ba976629d
|
data/lib/censive.rb
CHANGED
@@ -25,10 +25,11 @@
|
|
25
25
|
# 5. Implement support for scan_until(string) <= right now only regex is valid
|
26
26
|
# ============================================================================
|
27
27
|
|
28
|
+
require "stringio"
|
28
29
|
require "strscan"
|
29
30
|
|
30
31
|
class Censive < StringScanner
|
31
|
-
VERSION="1.0.
|
32
|
+
VERSION="1.0.3"
|
32
33
|
|
33
34
|
attr :encoding, :out, :rows
|
34
35
|
|
@@ -38,8 +39,8 @@ class Censive < StringScanner
|
|
38
39
|
|
39
40
|
def self.writer(obj=nil, **opts, &code)
|
40
41
|
case obj
|
41
|
-
when String
|
42
|
-
when IO,nil then new(out: obj, **opts, &code)
|
42
|
+
when String then File.open(obj, "w") {|io| new(out: io, **opts, &code) }
|
43
|
+
when StringIO,IO,nil then new(out: obj, **opts, &code)
|
43
44
|
else abort "#{File.basename($0)}: invalid #{obj.class} object in writer"
|
44
45
|
end
|
45
46
|
end
|
@@ -181,7 +182,7 @@ class Censive < StringScanner
|
|
181
182
|
end
|
182
183
|
|
183
184
|
def each
|
184
|
-
@rows
|
185
|
+
@rows or parse
|
185
186
|
@rows.each {|row| yield row }
|
186
187
|
end
|
187
188
|
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
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-
|
11
|
+
date: 2023-06-15 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.14
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: A quick and lightweight CSV handling library for Ruby
|