Class: WithTransactionalLock::Mixin::AdvisoryLockBase
- Inherits:
-
Object
- Object
- WithTransactionalLock::Mixin::AdvisoryLockBase
- Defined in:
- lib/with_transactional_lock/mixin.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#lock_name ⇒ Object
readonly
Returns the value of attribute lock_name.
Instance Method Summary collapse
-
#initialize(connection, lock_name) ⇒ AdvisoryLockBase
constructor
A new instance of AdvisoryLockBase.
- #yield_with_lock ⇒ Object
Constructor Details
#initialize(connection, lock_name) ⇒ AdvisoryLockBase
Returns a new instance of AdvisoryLockBase.
38 39 40 41 |
# File 'lib/with_transactional_lock/mixin.rb', line 38 def initialize(connection, lock_name) @connection = connection @lock_name = lock_name end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
36 37 38 |
# File 'lib/with_transactional_lock/mixin.rb', line 36 def connection @connection end |
#lock_name ⇒ Object (readonly)
Returns the value of attribute lock_name.
36 37 38 |
# File 'lib/with_transactional_lock/mixin.rb', line 36 def lock_name @lock_name end |
Instance Method Details
#yield_with_lock ⇒ Object
43 44 45 46 47 48 |
# File 'lib/with_transactional_lock/mixin.rb', line 43 def yield_with_lock connection.transaction do acquire_lock yield end end |