class FlowChart::FlowProcessor

Main Driver for FlowChart

Attributes

actions[RW]
flowstates[RW]
starting_flowstate[RW]

Public Class Methods

new(&flowprocessor) click to toggle source
# File lib/flowchart/flow_processor.rb, line 128
def initialize(&flowprocessor)
  @flowstates, @actions = Hash.new, Hash.new
  begin
    instance_eval(&flowprocessor)
  rescue => e
    p e.to_s
  end
end

Public Instance Methods

state_column(name = :process_status) click to toggle source
Default state_column is assumed to be process_status if not mentioned

You can override the default state_column by mentioning in your class state_column :something_else

# File lib/flowchart/flow_processor.rb, line 140
def state_column(name = :process_status)
  @state_column ||= name
end

Private Instance Methods

action(action_name, &transitions) click to toggle source
# File lib/flowchart/flow_processor.rb, line 159
def action(action_name, &transitions)
  action = FlowChart::Action.new(action_name, self, &transitions)
  @actions[action_name.to_sym] = action
end
flowstate(*flowstatenames, &options) click to toggle source
# File lib/flowchart/flow_processor.rb, line 149
def flowstate(*flowstatenames, &options)
  flowstatenames.each do |flowstatename|
    flowstate = FlowChart::State.new(flowstatename, &options)
    if @flowstates.empty? || @starting_flowstate_name == flowstatename
      @starting_flowstate = flowstate
    end
    @flowstates[flowstatename.to_sym] = flowstate
  end
end
init_flowstate(flowstate_name) click to toggle source
# File lib/flowchart/flow_processor.rb, line 145
def init_flowstate(flowstate_name)
  @starting_flowstate_name = flowstate_name
end