bfs 0.7.5 → 0.7.6

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: 61e0b8f8c56a60a7d3b933aacce3e476d400389bfa991b14b3adddf3af667108
4
- data.tar.gz: ab0da145b04da234825c0c418a5e5dc0fc3028627431072df04c5f2f7f45b652
3
+ metadata.gz: cd67ecfdb038d1809be4193caf014dfd9e8bcba4e26a4cd04da3c64e61522ddc
4
+ data.tar.gz: 17586a9b02836e8bdcbf4da6bc822d9c169cca9823b5817357dba1d4a5f1a072
5
5
  SHA512:
6
- metadata.gz: 4ba809e64dfdab6a918a807323acffd3228783d5c4c6a3ecc9712011ca742a2510e830fe7c2cbf73f2b0d900bdd9d5a9386e133c16ba3170b6be972366db0405
7
- data.tar.gz: 1999418b45ed5c090b7bf578f9ea6c8964eb49538b98068c6eff583480b1682d63ef61a04a3f9183ba54f027e9bd876b618d5297795c469c43127474e808449d
6
+ metadata.gz: e1ab4426da76e5a0de997d9b1f355c549197e4bd199629a37f6f787a9dcd068020c04ed190f117461490bb75d86a4070b475d481cc679005de731dacabb8fd64
7
+ data.tar.gz: 355cd6811da84829fad5f59927535b681c3f357968681d175c8a400f4e0b445920120daba944ea679dc965b582d65781063e2be199ffc372cda4e7df6739f89c
@@ -17,16 +17,17 @@ module BFS
17
17
  end
18
18
 
19
19
  def close
20
- close!
21
- @closer&.call(self)
20
+ super.tap do
21
+ @closer&.call(self)
22
+ end
22
23
  end
23
24
 
24
25
  def close!
25
26
  __getobj__.close
26
27
  end
27
28
 
28
- def perform(&block)
29
- return self unless block
29
+ def perform
30
+ return self unless block_given?
30
31
 
31
32
  begin
32
33
  yield self
@@ -11,8 +11,8 @@ module BFS
11
11
  super tempfile
12
12
  end
13
13
 
14
- def perform(&block)
15
- return self unless block
14
+ def perform
15
+ return self unless block_given?
16
16
 
17
17
  begin
18
18
  yield self
@@ -25,12 +25,10 @@ module BFS
25
25
  def close
26
26
  return if closed?
27
27
 
28
- tempfile = __getobj__
29
- tempfile.close
30
- @closer&.call(tempfile.path)
31
- true
32
- ensure
33
- tempfile.unlink
28
+ super.tap do
29
+ @closer&.call(path)
30
+ end
31
+ unlink
34
32
  end
35
33
  end
36
34
  end
@@ -15,9 +15,10 @@ RSpec.describe BFS::TempWriter, core: true do
15
15
  expect(subject.close).to be_truthy
16
16
  end
17
17
 
18
- it 'should exectute a closer block' do
19
- expect(closer).to receive(:call).with(subject.path)
18
+ it 'should execute a closer block' do
19
+ expect(closer).to receive(:call).with(subject.path).once
20
20
  expect(subject.close).to be_truthy
21
+ expect(subject.close).to be_nil
21
22
  end
22
23
 
23
24
  it 'may skip closer block' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Minimalist abstraction for bucket storage
14
14
  email: dimitrij@blacksquaremedia.com