Module: BigMachine::Lock

Extended by:
ActiveSupport::Concern
Defined in:
lib/big_machine/lock.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#enter(*args) ⇒ Object



22
23
24
# File 'lib/big_machine/lock.rb', line 22

def enter(*args)
  @locked = true
end

#locked?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/big_machine/lock.rb', line 18

def locked?
  @locked
end

#transition_to(state_class, *args, &block) ⇒ Object



30
31
32
33
34
# File 'lib/big_machine/lock.rb', line 30

def transition_to(state_class, *args, &block)
  return if @locked

  super(state_class, *args, &block)
end

#unlock(*args) ⇒ Object



26
27
28
# File 'lib/big_machine/lock.rb', line 26

def unlock(*args)
  @locked = false
end