Module: CallCenter::InstanceMethods

Defined in:
lib/call_center.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object (private)



89
90
91
92
93
94
95
96
97
# File 'lib/call_center.rb', line 89

def method_missing(*args, &blk)
  method_name = args.first.to_s
  if method_name =~ /^redirect_and_(.+)!$/
    args.shift
    redirect_to($1.to_sym, *args)
  else
    super
  end
end

Instance Method Details

#draw_call_flow(*args) ⇒ Object



71
72
73
# File 'lib/call_center.rb', line 71

def draw_call_flow(*args)
  self.class.current_state_machine.draw(*args)
end

#render(name = nil) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/call_center.rb', line 61

def render(name = nil)
  name ||= self.class.call_flow_state_machine_name
  return unless name
  CallCenter.render_twiml do |xml|
    if render_block = state_machine_for_name(name).block_accessor(:response_blocks, current_state(name))
      render_block.arity == 2 ? self.instance_exec(xml, self, &render_block) : self.instance_exec(xml, &render_block)
    end
  end
end