Class: RubyAMI::Lexer
- Inherits:
-
Object
- Object
- RubyAMI::Lexer
- Defined in:
- lib/ruby_ami/lexer.rb
Constant Summary collapse
- STANZA_BREAK =
"\r\n\r\n"
- PROMPT =
/Asterisk Call Manager\/(\d+(\.\d+)*)\r\n/
- KEYVALUEPAIR =
/^([[[:alnum:]]-_ ]+): *(.*)\r\n/
- FOLLOWSDELIMITER =
/\r?\n?--END COMMAND--\r\n\r\n/
- SUCCESS =
/response: *success/i
- PONG =
/response: *pong/i
- EVENT =
/event: *(?<event_name>.*)?/i
- ERROR =
/response: *error/i
- FOLLOWS =
/response: *follows/i
- GOODBYE =
/response: *goodbye/i
- SCANNER =
/.*?#{STANZA_BREAK}/m
- HEADER_SLICE =
/.*\r\n/
- IMMEDIATE_RESP =
/.*/
- CLASSIFIER =
/((?<event>#{EVENT})|(?<success>#{SUCCESS})|(?<pong>#{PONG})|(?<follows>#{FOLLOWS})|(?<error>#{ERROR})|(?<goodbye>#{GOODBYE})|(?<immediate>#{IMMEDIATE_RESP})\r\n)\r\n/i
Instance Attribute Summary collapse
-
#ami_version ⇒ Object
Returns the value of attribute ami_version.
Instance Method Summary collapse
- #<<(new_data) ⇒ Object
-
#initialize(delegate = nil) ⇒ Lexer
constructor
A new instance of Lexer.
Constructor Details
#initialize(delegate = nil) ⇒ Lexer
Returns a new instance of Lexer.
22 23 24 25 26 |
# File 'lib/ruby_ami/lexer.rb', line 22 def initialize(delegate = nil) @delegate = delegate @buffer = "" @ami_version = nil end |
Instance Attribute Details
#ami_version ⇒ Object
Returns the value of attribute ami_version.
20 21 22 |
# File 'lib/ruby_ami/lexer.rb', line 20 def ami_version @ami_version end |
Instance Method Details
#<<(new_data) ⇒ Object
28 29 30 31 |
# File 'lib/ruby_ami/lexer.rb', line 28 def <<(new_data) @buffer << new_data parse_buffer end |