Class: Adhearsion::VoIP::Asterisk::Manager::DelegatingAsteriskManagerInterfaceLexer

Inherits:
AbstractAsteriskManagerInterfaceStreamLexer show all
Defined in:
lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb

Constant Summary

Constants inherited from AbstractAsteriskManagerInterfaceStreamLexer

AbstractAsteriskManagerInterfaceStreamLexer::BUFFER_SIZE

Instance Attribute Summary

Attributes inherited from AbstractAsteriskManagerInterfaceStreamLexer

#ami_version

Instance Method Summary collapse

Methods inherited from AbstractAsteriskManagerInterfaceStreamLexer

#<<, #extend_buffer_with, #resume!

Constructor Details

#initialize(delegate, method_delegation_map = nil) ⇒ DelegatingAsteriskManagerInterfaceLexer

Returns a new instance of DelegatingAsteriskManagerInterfaceLexer.



1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb', line 1559

def initialize(delegate, method_delegation_map=nil)
  super()
  @delegate = delegate
  
  @message_received_method = method_delegation_map && method_delegation_map.has_key?(:message_received) ?
      method_delegation_map[:message_received] : :message_received
  
  @error_received_method = method_delegation_map && method_delegation_map.has_key?(:error_received) ?
      method_delegation_map[:error_received] : :error_received
  
  @syntax_error_method = method_delegation_map && method_delegation_map.has_key?(:syntax_error_encountered) ?
      method_delegation_map[:syntax_error_encountered] : :syntax_error_encountered
end

Instance Method Details

#error_received(message) ⇒ Object



1577
1578
1579
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb', line 1577

def error_received(message)
  @delegate.send(@error_received_method, message)
end

#message_received(message) ⇒ Object



1573
1574
1575
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb', line 1573

def message_received(message)
  @delegate.send(@message_received_method, message)
end

#syntax_error_encountered(ignored_chunk) ⇒ Object



1581
1582
1583
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb', line 1581

def syntax_error_encountered(ignored_chunk)
  @delegate.send(@syntax_error_method, ignored_chunk)
end