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
# File 'lib/taskinator/workflow.rb', line 4

def current_state
  @current_state ||= load_workflow_state
end

#current_state=(new_state) ⇒ Object



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

def current_state=(new_state)
  return if new_state == @current_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