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)


86
87
88
89
90
91
92
93
94
# File 'lib/call_center.rb', line 86

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


68
69
70
# File 'lib/call_center.rb', line 68

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

#render(name = nil) ⇒ Object


58
59
60
61
62
63
64
65
66
# File 'lib/call_center.rb', line 58

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