Class: EWorkflow

Inherits:
Object
  • Object
show all
Defined in:
app/models/e_workflow.rb

Overview

EWorkflow describes transitions between E_ACTIONS for the different E_BATCH.E_TYPES.

Class Method Summary collapse

Class Method Details

.next_action(e_type, last_e_actiontype) ⇒ Object

Returns the name of the next step on the waterfall. Caches all results. EWorkflow.next_action('COSD_XML', 'AIMP') #=> "PRECHECK" EWorkflow.next_action('COSD_XML', 'GENA') #=> nil



14
15
16
17
18
19
20
21
# File 'app/models/e_workflow.rb', line 14

def next_action(e_type, last_e_actiontype)
  @next_actions ||= Hash.new do |hash, (type, last_action)|
    scope = { e_type: type, last_e_actiontype: last_action }
    hash[[type, last_action]] = where(scope).pluck(:next_e_actiontype).first
  end

  @next_actions[[e_type, last_e_actiontype]]
end