lib/ruby_ami/lexer.rb in ruby_ami-2.2.1 vs lib/ruby_ami/lexer.rb in ruby_ami-2.3.0
- old
+ new
@@ -9,14 +9,15 @@
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})|(?<immediate>#{IMMEDIATE_RESP})\r\n)\r\n/i
+ CLASSIFIER = /((?<event>#{EVENT})|(?<success>#{SUCCESS})|(?<pong>#{PONG})|(?<follows>#{FOLLOWS})|(?<error>#{ERROR})|(?<goodbye>#{GOODBYE})|(?<immediate>#{IMMEDIATE_RESP})\r\n)\r\n/i
attr_accessor :ami_version
def initialize(delegate = nil)
@delegate = delegate
@@ -67,10 +68,10 @@
match = raw.match CLASSIFIER
msg = if match[:event]
Event.new match[:event_name]
- elsif match[:success] || match[:pong]
+ elsif match[:success] || match[:pong] || match[:goodbye]
Response.new
elsif match[:follows]
response_follows = true
Response.new
elsif match[:error]