Class: CapistranoMulticonfigParallel::StateMachine

Inherits:
Object
  • Object
show all
Includes:
ComposableStateMachine::CallbackRunner
Defined in:
lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb

Overview

class that handles the states of the celluloid worker executing the child process in a fork process

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, actor) ⇒ StateMachine

Returns a new instance of StateMachine.



7
8
9
10
11
12
13
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 7

def initialize(job, actor)
  @job = job
  @actor = actor
  @initial_state = :unstarted
  @model = generate_model
  build_machine
end

Instance Attribute Details

#initial_stateObject

Returns the value of attribute initial_state.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def initial_state
  @initial_state
end

#jobObject

Returns the value of attribute job.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def job
  @job
end

#machineObject

Returns the value of attribute machine.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def machine
  @machine
end

#modelObject

Returns the value of attribute model.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def model
  @model
end

#outputObject

Returns the value of attribute output.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def output
  @output
end

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def state
  @state
end

#transitionsObject

Returns the value of attribute transitions.



5
6
7
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 5

def transitions
  @transitions
end

Instance Method Details

#go_to_transition(action) ⇒ Object



15
16
17
# File 'lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb', line 15

def go_to_transition(action)
  @machine.trigger(action.to_s)
end