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


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

def call_flow(*args, &blk)
  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


52
53
54
# File 'lib/call_center.rb', line 52

def current_state_machine
  self.state_machines[self.call_flow_state_machine_name]
end