module HAP::Parser
Public Instance Methods
init_parser()
click to toggle source
# File lib/hap_client/parser.rb, line 5 def init_parser @parser = Http::Parser.new(self) end
on_body(chunk)
click to toggle source
# File lib/hap_client/parser.rb, line 30 def on_body(chunk) @body << chunk end
on_headers_complete(headers)
click to toggle source
# File lib/hap_client/parser.rb, line 26 def on_headers_complete(headers) @headers = headers end
on_message_begin()
click to toggle source
# File lib/hap_client/parser.rb, line 21 def on_message_begin @headers = nil @body = '' end
on_message_complete()
click to toggle source
# File lib/hap_client/parser.rb, line 34 def on_message_complete parse_message(@body) end
receive_data(data)
click to toggle source
# File lib/hap_client/parser.rb, line 9 def receive_data(data) if encryption_ready? data = decrypt(data) if data.start_with?("EVENT/") data.sub!("EVENT/","HTTP/") end end @parser << data end