Method: Colloquy::FlowParser::InstanceMethods#apply

Defined in:
lib/colloquy/flow_parser.rb

#apply(input = nil) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/colloquy/flow_parser.rb', line 57

def apply(input = nil)
  reset_nodes!
  input = sanitize_input(input)
  
  store_previous_state!
  
  case state[:flow_state].to_sym
  when :init
    store_back_state!
    
    apply_request(input)
  when :request
    apply_process(input)
  else
    raise Colloquy::FlowStateInconsistent, "An unexpected flow state: #{state[:flow_state]} was found"
  end
rescue Colloquy::NotifyJump => e
  notify! e.payload
rescue Colloquy::SwitchJump => e
  switch! e.payload
rescue Colloquy::SwitchBackJump => e
  switch_back!
rescue Colloquy::PassJump => e
  pass! input
end