feedx 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/feedx.gemspec +1 -1
- data/lib/feedx/stream.rb +3 -2
- data/spec/feedx/stream_spec.rb +3 -1
- 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: 898f80c359182952ab192f95fb05dc1e6ae806f0d661d71244813b779595d0f8
|
4
|
+
data.tar.gz: 43778c6084131e8ffa9ba59b7836fe198f7595e5dc07af1c4e11a9b03ac49419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa8f2e4e26c140bb4c2732655ac73c39ef20055f215ac39c8c62bd77e7cf27d7d8140287ed6c90a4c4da6bf461d491123f76784ce5d770189a45da7fea897965
|
7
|
+
data.tar.gz: a35d5296c5aec452b450e95985535c98b6b99f1a872624b3ad3974cbb0f56b0e6d0ae8395edd849c97242ae0a77ee77537404cb3dce22882a3a310a6e0f04a04
|
data/Gemfile.lock
CHANGED
data/feedx.gemspec
CHANGED
data/lib/feedx/stream.rb
CHANGED
@@ -10,12 +10,13 @@ module Feedx
|
|
10
10
|
# If a block is given, streams are automatically closed after the block is yielded.
|
11
11
|
def self.open(url, **opts)
|
12
12
|
stream = new(url, **opts)
|
13
|
+
return stream unless block_given?
|
14
|
+
|
13
15
|
begin
|
14
16
|
yield stream
|
15
17
|
ensure
|
16
18
|
stream.close
|
17
|
-
end
|
18
|
-
stream
|
19
|
+
end
|
19
20
|
end
|
20
21
|
|
21
22
|
# @param [String] url the blob URL.
|
data/spec/feedx/stream_spec.rb
CHANGED
@@ -27,9 +27,11 @@ RSpec.describe Feedx::Stream do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
described_class.open('mock:///dir/file.txt', format: format.new) do |stream|
|
30
|
+
result = described_class.open('mock:///dir/file.txt', format: format.new) do |stream|
|
31
31
|
stream.create {|s| s.encode Feedx::TestCase::Model.new('X') }
|
32
|
+
21
|
32
33
|
end
|
34
|
+
expect(result).to eq(21)
|
33
35
|
|
34
36
|
expect(bucket.read('dir/file.txt')).to eq(
|
35
37
|
%({"title":"X","updated_at":"2018-01-05 11:25:15 UTC"}\n),
|