Module: Mongo::Lock::ClassConvenienceMethods
- Included in:
- Mongo::Lock
- Defined in:
- lib/mongo-lock/class_convenience_methods.rb
Instance Method Summary collapse
- #acquire(key, options = {}, &block) ⇒ Object
- #acquire!(key, options = {}) ⇒ Object
- #available?(key, options = {}) ⇒ Boolean
- #init_and_send(key, options = {}, method, &block) ⇒ Object
- #release(key, options = {}) ⇒ Object
- #release!(key, options = {}) ⇒ Object
Instance Method Details
#acquire(key, options = {}, &block) ⇒ Object
11 12 13 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 11 def acquire key, = {}, &block init_and_send key, , :acquire, &block end |
#acquire!(key, options = {}) ⇒ Object
19 20 21 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 19 def acquire! key, = {} init_and_send key, , :acquire! end |
#available?(key, options = {}) ⇒ Boolean
27 28 29 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 27 def available? key, = {} Mongo::Lock.new(key, ).available? end |
#init_and_send(key, options = {}, method, &block) ⇒ Object
5 6 7 8 9 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 5 def init_and_send key, = {}, method, &block lock = Mongo::Lock.new(key, ) lock.send(method, &block) lock end |
#release(key, options = {}) ⇒ Object
15 16 17 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 15 def release key, = {} init_and_send key, , :release end |
#release!(key, options = {}) ⇒ Object
23 24 25 |
# File 'lib/mongo-lock/class_convenience_methods.rb', line 23 def release! key, = {} init_and_send key, , :release! end |