censive 1.0.4 → 1.0.5
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 +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6f156186b0612f198563d23cd09fa0cf65d823a92b031bd71a3e22335163b73
|
4
|
+
data.tar.gz: 6ac6ba05c9ee8cb52d1a3c5573dde803144651c7b4a2f3af9d83596d7365bf1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a078837538b6693a92586ebc997e0c7564952509991997215f7e0994d5ebaf29fdde4732feb72a2f418c4d2927115f23e1a7948e9f98a071438bff4c7fa8d255
|
7
|
+
data.tar.gz: 3c28503ad4dc72fbcc0140d61e5d94d6ae44d9deb70842b40bd23406438f7de6b3a2557a39271f463ed1acf93f968e5543b8481d2b02b458a04a3389fa7f6e1f
|
data/lib/censive.rb
CHANGED
@@ -29,7 +29,7 @@ require "stringio"
|
|
29
29
|
require "strscan"
|
30
30
|
|
31
31
|
class Censive < StringScanner
|
32
|
-
VERSION="1.0.
|
32
|
+
VERSION="1.0.5"
|
33
33
|
|
34
34
|
attr :encoding, :out, :rows
|
35
35
|
|
@@ -39,9 +39,16 @@ class Censive < StringScanner
|
|
39
39
|
|
40
40
|
def self.writer(obj=nil, **opts, &code)
|
41
41
|
case obj
|
42
|
-
when String
|
43
|
-
|
44
|
-
|
42
|
+
when String
|
43
|
+
if block_given?
|
44
|
+
File.open(obj, "w") {|io| new(out: io, **opts, &code) }
|
45
|
+
else
|
46
|
+
new(out: File.open(obj, "w"), **opts)
|
47
|
+
end
|
48
|
+
when StringIO, IO, nil
|
49
|
+
new(out: obj, **opts, &code)
|
50
|
+
else
|
51
|
+
abort "#{File.basename($0)}: invalid #{obj.class} object in writer"
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
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.5
|
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-06-
|
11
|
+
date: 2023-06-27 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
|