dbf 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a59c64cae2987160691a8cc8e99ed63e68cd7e50b5dbc1941a186454d5c37903
4
- data.tar.gz: 618e8a2512bab2d9cedf26e94e1bca45159db880d11243695669c3bbc43452ac
3
+ metadata.gz: 4db2b075394f8f3cb60fc36e71a71eb9f8367e7b34b8863481fe6c2ab0a2aeac
4
+ data.tar.gz: f3e7ba5bd793d1732d2ae20b23b3a56285fa81228d06db9d38b055049591b76e
5
5
  SHA512:
6
- metadata.gz: cdd9d908bbc01b061d300ce780c83577f0bbaff1dcaba5375a69e71d43714d599a62879c0f6f56537a7d059764fc32102ca97eb67c4cafe6c38a68563ec88f74
7
- data.tar.gz: 663fc952afb30bf77a5287edac7118ce5ab649cf3819f4a40994dd2f533765be9c42ec5e825a3443b47f5eba79393216fdc1448a6ebfd95fd8e1016d2fc69283
6
+ metadata.gz: b7c5847999bf422df92d90bbdea11bf0d6baa09ace5649cd65814b22cb5192a5ec085e8b25b9a2c56cb889f0f23d0fd0e3e20561c737ae05857afb63db69aea4
7
+ data.tar.gz: e1ed01f59b6f13e5bd3a91b327cdcd2060f85f2a608dfaf3e4dae1723f9a97b0ef2221465b0ae14aed1345e99b0c6c8edf9de00259f8a741914d889212ca5dc6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.1
4
+
5
+ - Raise ArgumentError data is not a string or StringIO object
6
+
3
7
  ## 5.0.0
4
8
 
5
9
  - Refactor the Column class to support non-ASCII header names
data/lib/dbf/table.rb CHANGED
@@ -308,7 +308,14 @@ module DBF
308
308
  end
309
309
 
310
310
  def open_data(data) # :nodoc:
311
- data.is_a?(StringIO) ? data : File.open(data, 'rb')
311
+ case data
312
+ when StringIO
313
+ data
314
+ when String
315
+ File.open(data, 'rb')
316
+ else
317
+ raise ArgumentError, 'data must be a file path or StringIO object'
318
+ end
312
319
  rescue Errno::ENOENT
313
320
  raise DBF::FileNotFoundError, "file not found: #{data}"
314
321
  end
data/lib/dbf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DBF
2
- VERSION = '5.0.0'.freeze
2
+ VERSION = '5.0.1'.freeze
3
3
  end
@@ -29,6 +29,12 @@ RSpec.describe DBF::Table do
29
29
  end
30
30
  end
31
31
 
32
+ describe 'when data is nil' do
33
+ it 'raises ArgumentError' do
34
+ expect { DBF::Table.new nil }.to raise_error(ArgumentError, 'data must be a file path or StringIO object')
35
+ end
36
+ end
37
+
32
38
  describe 'when given paths to existing dbf and memo files' do
33
39
  it 'does not raise an error' do
34
40
  expect { DBF::Table.new dbf_path, memo_path }.to_not raise_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbf
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Morrison