mlanett-redis-lock 0.2.6 → 0.2.7

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
  SHA1:
3
- metadata.gz: 8653d5ba9f70e19ce5c3a9339d37bb15004d96b6
4
- data.tar.gz: dad098554516ff262a63cfc058aa1c810794f6f1
3
+ metadata.gz: 148ebe29b3ebd72bd6cc37ab0e34b471326c8076
4
+ data.tar.gz: 2e6110d8ba371f5ad6d7ee40ae5e35ad1b555c78
5
5
  SHA512:
6
- metadata.gz: 61eef5bf0f94af47e60fcb80345216207b3d944dc32a8f2bc60e0f02d0273b468b679d3f2507bb6e67a5657848884b57df292bd59d204285a3067cd8dab138c8
7
- data.tar.gz: 0db86b2e4bfb5b5289d5fb93f30e8e12790aac939b6485ccc769b892327ee0b87bb1ce1bbf448b8a25371f8653550a99501c7280114146ca99eff1a19928fe09
6
+ metadata.gz: 52b8e7beac0570d9bd348cf0ec8f90a5f1dc3ff5fa8ebde0e5e44a7d04f4dde99614e1e799d695bc5184a314a3bf39c096b3cd6c09bf7c56b9f784e30b712a79
7
+ data.tar.gz: 9fa50ba005240a11dee08225481842012c52a1d2b25f0bcfbd0f872509f46d55a72b4e36646e62214163891ec86caa16a309cd3d150b3fd600ff44292022c4f8
data/README.md CHANGED
@@ -67,7 +67,7 @@ The code which cleans the stale lock must not interfere with a different owner a
67
67
 
68
68
  ## Contributors
69
69
 
70
- Alexander Lang (langalex), Jonathan Hyman (jonhyman), Jamie Cobbett (jamiecobbett), and Ravil Bayramgalin (brainopia) have contributed to Redis Lock.
70
+ Alexander Lang (langalex), Jonathan Hyman (jonhyman), Jamie Cobbett (jamiecobbett), Ravil Bayramgalin (brainopia), and Tom Mornini (tmornini) have contributed to Redis Lock.
71
71
 
72
72
  ## Contributing
73
73
 
@@ -228,7 +228,10 @@ class Redis
228
228
  # @param options[:acquire] defaults to 10 seconds and can be used to determine how long to wait for a lock.
229
229
  def lock( key, options = {}, &block )
230
230
  acquire = options.delete(:acquire) || 10
231
- Redis::Lock.new( self, key, options ).lock( acquire, &block )
231
+
232
+ lock = Redis::Lock.new self, key, options
233
+
234
+ block_given? ? lock.lock(acquire, &block) : lock
232
235
  end
233
236
 
234
237
  def unlock( key )
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  class Lock
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/redis-lock/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Mark Lanett", "Ravil Bayramgalin", "Jamie Cobbett", "Jonathan Hyman", "Alexander Lang"]
5
+ gem.authors = ["Mark Lanett", "Ravil Bayramgalin", "Jamie Cobbett", "Jonathan Hyman", "Alexander Lang", "Tom Mornini"]
6
6
  gem.email = ["mark.lanett@gmail.com"]
7
7
  gem.description = %q{Pessimistic locking using Redis}
8
8
  gem.summary = %q{Pessimistic locking using Redis}
@@ -136,10 +136,17 @@ describe Redis::Lock, redis: true do
136
136
  # We leave [ present, present ] to be unspecified.
137
137
  end
138
138
 
139
- example "How to get a lock using the helper." do
139
+ example "How to get a lock using the helper when passing a block" do
140
140
  redis.lock "mykey", life: 10, acquire: 1 do |lock|
141
141
  lock.extend_life 10
142
- end
142
+ :return_value_of_block
143
+ end.should eql(:return_value_of_block)
144
+ end
145
+
146
+ example "How to get a lock using the helper when not passing a block" do
147
+ lock = redis.lock "mykey", life: 10, acquire: 1
148
+ lock.should be_an_instance_of(Redis::Lock)
149
+ lock.unlock
143
150
  end
144
151
 
145
152
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlanett-redis-lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Lanett
@@ -9,10 +9,11 @@ authors:
9
9
  - Jamie Cobbett
10
10
  - Jonathan Hyman
11
11
  - Alexander Lang
12
+ - Tom Mornini
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2014-03-27 00:00:00.000000000 Z
16
+ date: 2015-10-22 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: redis
@@ -74,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  version: '0'
75
76
  requirements: []
76
77
  rubyforge_project:
77
- rubygems_version: 2.2.2
78
+ rubygems_version: 2.4.5.1
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: Pessimistic locking using Redis