Module: Taskinator::Workflow

Included in:
Process, Task
Defined in:
lib/taskinator/workflow.rb

Instance Method Summary collapse

Instance Method Details

#current_stateObject



4
5
6
7
# File 'lib/taskinator/workflow.rb', line 4

def current_state
  # NB: don't memoize this value (i.e. re-read it each time)
  @current_state = load_workflow_state
end

#current_state=(new_state) ⇒ Object



9
10
11
# File 'lib/taskinator/workflow.rb', line 9

def current_state=(new_state)
  @current_state = persist_workflow_state(new_state)
end

#transition(new_state) ⇒ Object



13
14
15
16
17
# File 'lib/taskinator/workflow.rb', line 13

def transition(new_state)
  self.current_state = new_state
  yield if block_given?
  current_state
end