Class: Lightstreamer::StreamConnectionHeader
- Inherits:
-
Object
- Object
- Lightstreamer::StreamConnectionHeader
- Defined in:
- lib/lightstreamer/stream_connection_header.rb
Overview
Helper class that processes the contents of the header returned by the server when a new stream connection is created or an existing session is bound to.
Instance Attribute Summary collapse
-
#error ⇒ Error
readonly
If there was an error in the header then this value will be set to the error instance that should be raised in response.
Instance Method Summary collapse
-
#[](item_name) ⇒ String?
Returns the value for the item with the specified name in this header, or
nilif no item with the specified name was part of this header. -
#initialize ⇒ StreamConnectionHeader
constructor
A new instance of StreamConnectionHeader.
-
#process_header_line(line) ⇒ Boolean
Processes a single line of header information.
Constructor Details
#initialize ⇒ StreamConnectionHeader
Returns a new instance of StreamConnectionHeader.
9 10 11 12 |
# File 'lib/lightstreamer/stream_connection_header.rb', line 9 def initialize @data = {} @lines = [] end |
Instance Attribute Details
#error ⇒ Error (readonly)
Returns If there was an error in the header then this value will be set to the error instance that should be raised in response.
7 8 9 |
# File 'lib/lightstreamer/stream_connection_header.rb', line 7 def error @error end |
Instance Method Details
#[](item_name) ⇒ String?
Returns the value for the item with the specified name in this header, or nil if no item with the specified name was part of this header.
38 39 40 |
# File 'lib/lightstreamer/stream_connection_header.rb', line 38 def [](item_name) @data[item_name] end |
#process_header_line(line) ⇒ Boolean
Processes a single line of header information. The return value indicates whether further data is required in order to complete the header.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lightstreamer/stream_connection_header.rb', line 20 def process_header_line(line) @lines << line return process_success if @lines.first == 'OK' return process_error if @lines.first == 'ERROR' return process_end if @lines.first == 'END' return process_sync_error if @lines.first == 'SYNC ERROR' process_unrecognized end |