Module: Barricade

Included in:
ActiveRecord::Base
Defined in:
lib/barricade.rb

Overview

Methods defined here are included as instance methods on ActiveRecord::Base.

Defined Under Namespace

Modules: ClassMethods Classes: Configuration, LockMustBeOutermostTransaction, LockNotHeld, RetryTransaction

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject

:nodoc:



4
5
6
# File 'lib/barricade.rb', line 4

def self.configuration #:nodoc:
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



8
9
10
# File 'lib/barricade.rb', line 8

def self.configure
  yield(configuration)
end

.included(base) ⇒ Object

:nodoc:



23
24
25
# File 'lib/barricade.rb', line 23

def self.included(base) #:nodoc:
  base.extend(ClassMethods)
end

Instance Method Details

#confirm_locked!Object

Confirms that this object has been locked in an enclosing call to transaction_with_locks. Raises LockNotHeld if the lock isn’t held.

Raises:



29
30
31
# File 'lib/barricade.rb', line 29

def confirm_locked!
  raise LockNotHeld unless ActiveRecord::Base.locked_objects.include?(self)
end