censive 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/censive.rb +11 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14b2b860b44e06018a627322fe8cb2d6b2e437a0f24cd21ad110d6a7f8f6170e
4
- data.tar.gz: 942fc5ddcff3239e654ba391a72209e09844ac4e9df430c762ef0d54d38095b4
3
+ metadata.gz: a6f156186b0612f198563d23cd09fa0cf65d823a92b031bd71a3e22335163b73
4
+ data.tar.gz: 6ac6ba05c9ee8cb52d1a3c5573dde803144651c7b4a2f3af9d83596d7365bf1c
5
5
  SHA512:
6
- metadata.gz: 38677787034eb1de1d4272fe0e5b8f5629c14fe28f69d3d1b05652644fc76d3b2fcdd80bdde3c91b5c4107ec634a28f7d7e58b7f417ada84fa2190d76ba3c2d5
7
- data.tar.gz: 1f6496e143fd7ee75cea6797cf59f55fdda5fc877a5aeb53580de0680827666e66f97b15018db7fd197169366af8ce1f09e2f9a8a014eea70faf784bdb276ef6
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.4"
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 then File.open(obj, "w") {|io| new(out: io, **opts, &code) }
43
- when StringIO,IO,nil then new(out: obj, **opts, &code)
44
- else abort "#{File.basename($0)}: invalid #{obj.class} object in writer"
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
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-16 00:00:00.000000000 Z
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