Method: Colloquy::FlowParser::InstanceMethods#initialize

Defined in:
lib/colloquy/flow_parser.rb

#initialize(flow_name = nil, options = {}) ⇒ Object

Initializes the flow

Parameters:

  • options (Hash) (defaults to: {})

    A list of options passed on to the flow.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/colloquy/flow_parser.rb', line 23

def initialize(flow_name = nil, options = {})
  @flow_name = flow_name.to_sym if flow_name
  @logger = options[:logger] || Logger.new(STDOUT)
  @session = HashWithIndifferentAccess.new(options[:session] || {})
  @messages = options[:messages] || {}
  @headers = {}
  
  self.state = options[:state]
  @nodes = options[:nodes] || []
  
  setup if self.class.method_defined?(:setup)
  
  create_nodes_from_definitions! if @nodes.empty?
end