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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dbf/table.rb +8 -1
- data/lib/dbf/version.rb +1 -1
- data/spec/dbf/table_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db2b075394f8f3cb60fc36e71a71eb9f8367e7b34b8863481fe6c2ab0a2aeac
|
4
|
+
data.tar.gz: f3e7ba5bd793d1732d2ae20b23b3a56285fa81228d06db9d38b055049591b76e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7c5847999bf422df92d90bbdea11bf0d6baa09ace5649cd65814b22cb5192a5ec085e8b25b9a2c56cb889f0f23d0fd0e3e20561c737ae05857afb63db69aea4
|
7
|
+
data.tar.gz: e1ed01f59b6f13e5bd3a91b327cdcd2060f85f2a608dfaf3e4dae1723f9a97b0ef2221465b0ae14aed1345e99b0c6c8edf9de00259f8a741914d889212ca5dc6
|
data/CHANGELOG.md
CHANGED
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
|
-
|
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
data/spec/dbf/table_spec.rb
CHANGED
@@ -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
|