Module: CallCenter::ClassMethods

Defined in:
lib/call_center.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#call_flow_state_machine_nameObject

Returns the value of attribute call_flow_state_machine_name.



38
39
40
# File 'lib/call_center.rb', line 38

def call_flow_state_machine_name
  @call_flow_state_machine_name
end

Instance Method Details

#call_flow(*args, &blk) ⇒ Object

Calls state_machine … with :syntax => :alternate



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/call_center.rb', line 41

def call_flow(*args, &blk)
  options = args.last.is_a?(Hash) ? args.pop : {}
  args << options.merge(:syntax => :alternate)
  state_machine_name = args.first || :state
  if state_machine = CallCenter.cached(self, state_machine_name)
    state_machine = state_machine.duplicate_to(self)
  else
    state_machine = state_machine(*args, &blk).setup_call_flow(self)
    CallCenter.cache(self, state_machine)
  end
  self.call_flow_state_machine_name ||= state_machine.name
  state_machine
end

#current_state_machineObject



55
56
57
# File 'lib/call_center.rb', line 55

def current_state_machine
  self.state_machines[self.call_flow_state_machine_name]
end