censive 1.0.1 → 1.0.3

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 +5 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3db4c7bfa5df5911b7ec460329f59b1dc858881fcfc65e7bab98800861c40b5b
4
- data.tar.gz: 2f0e4b3ec85aab97c5b9c1436513a0fa4cafb0395f6b02abe6275346ab684bc7
3
+ metadata.gz: 6b3192a24670593887dbf1e955c2db44c912248b4eef81c2f89d411190ff7a7c
4
+ data.tar.gz: f95e5e02f4930f8478fa0bae557e13f72d93637e7bb1d4458a6fa46e022f76cb
5
5
  SHA512:
6
- metadata.gz: dcc066cfd497a52a2481137233c40af86048d41889ce01d08d03ddf21a79e29e1e0236bc2fa4a9aeda35ef03d8f24061e5e4978a047f8a8ab9715bd0e902a0af
7
- data.tar.gz: 3a3bbbbfb2fc787dc1b58c1f295fa25d0d4a1060310d457230aa1b3e4b675a5539c3b91eedf384edef1abf0c3b9ff58e1d6c191571af8f58034edc503266f7f8
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.1"
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 then File.open(obj, "w") {|io| new(out: io, **opts, &code) }
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 ||= parse
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.1
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-04-10 00:00:00.000000000 Z
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.10
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