class TransactionalLock::TransactionWrapper
Public Class Methods
deassign_root_wrapper(wrapper) { || ... }
click to toggle source
If the specified wrapper is the root wrapper, it will be deassigned and the block passed to this function will be executed
# File lib/transactional_lock/transaction_wrapper.rb, line 12 def self.deassign_root_wrapper(wrapper) if wrapper == @root_wrapper @root_wrapper = nil yield end end
try_assign_root_wrapper(wrapper)
click to toggle source
If the root wrapper is not yet set, the specified wrapper will become the root wrapper.
# File lib/transactional_lock/transaction_wrapper.rb, line 6 def self.try_assign_root_wrapper(wrapper) @root_wrapper ||= wrapper end
Public Instance Methods
wrap() { || ... }
click to toggle source
# File lib/transactional_lock/transaction_wrapper.rb, line 19 def wrap self.class.try_assign_root_wrapper(self) yield ensure self.class.deassign_root_wrapper(self) do ::TransactionalLock::AdvisoryLock.release_all_locks end end