futex 0.8.0 → 0.8.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: e077d8eafaa333121b04b808c43d91a7e8e5a7704bfd33ed82be8f978d3748bf
4
- data.tar.gz: 05a7e8ed6eca0572f930a678fc933175c07e6c96a261e27e4b5fa75ccb3f7130
3
+ metadata.gz: d8a8d71051dbbfbccbf315a3ff9db4a8412d254a6f2076a759c5cc0ed27f1e34
4
+ data.tar.gz: 6f89829eb5326e4152c8422e8d5057c4c54c9e74cab0593c959d52aa2ef76b1f
5
5
  SHA512:
6
- metadata.gz: 3b5b11770396e1fe729dffd41f33c0fb0328760ada247b749969083b74076207d36e0e3c805234a88169a30e71d1b419e92c01ba1e884022d8df259df4135112
7
- data.tar.gz: 8647c6a0277f269b38ee43085db288c61d6f49d18d4d09df186aaa22214168dd2e8d9dc1e81e46197f9c274df6592abf4eac08d867e58d8c6468dd92ffbe8e32
6
+ metadata.gz: 379a44ca71ef3e5e76f92a89ee5a702177c4561e3c251a973caed8958182656bca60b469d46642f0cd753a9047b9daf96b43e759705f06af737141a97948011a
7
+ data.tar.gz: e50ddd647eb79bd744a5f382be7600cff51779d6392feb699cc308bf59c1a67779a04675bf863f8d5bd70ded46835c9bfdc8300a95ba21e53c6c2c35176ac09f
data/futex.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.rubygems_version = '2.3.3'
32
32
  s.required_ruby_version = '>=2.3'
33
33
  s.name = 'futex'
34
- s.version = '0.8.0'
34
+ s.version = '0.8.1'
35
35
  s.license = 'MIT'
36
36
  s.summary = 'File-based mutex'
37
37
  s.description = 'Ruby Gem for file-based locking'
data/lib/futex.rb CHANGED
@@ -121,7 +121,7 @@ access to #{@path}, #{age(start)} already: #{IO.read(@lock)} \
121
121
  #{@path} (attempt no.#{cycle})")
122
122
  File.write(@lock, b)
123
123
  acq = Time.now
124
- res = yield(@path)
124
+ res = block_given? ? yield(@path) : nil
125
125
  debug("Unlocked by #{b} in #{age(acq)}, #{prefix}exclusive: #{@path}")
126
126
  res
127
127
  end
data/test/test_futex.rb CHANGED
@@ -159,4 +159,10 @@ class FutexTest < Minitest::Test
159
159
  end
160
160
  end
161
161
  end
162
+
163
+ def test_works_without_block_given
164
+ Dir.mktmpdir do |dir|
165
+ Futex.new(File.join(dir, 'hey.txt')).open
166
+ end
167
+ end
162
168
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko