Class: Lightstreamer::SendMessageOutcomeMessage
- Inherits:
-
Object
- Object
- Lightstreamer::SendMessageOutcomeMessage
- Defined in:
- lib/lightstreamer/messages/send_message_outcome_message.rb
Overview
Helper class used by Session in order to parse incoming overflow send message outcome messages.
Instance Attribute Summary collapse
-
#error ⇒ LightstreamerError?
If an error occurred processing the message then it will be set here.
-
#numbers ⇒ Array<Fixnum>
The message number(s) this message outcome is for.
-
#sequence ⇒ String
The name of the sequence this message outcome is for.
Class Method Summary collapse
-
.parse(line) ⇒ Object
Attempts to parses the specified line as a message outcome message and returns an instance of SendMessageOutcomeMessage on success, or ‘nil` on failure.
Instance Attribute Details
#error ⇒ LightstreamerError?
If an error occurred processing the message then it will be set here.
21 22 23 |
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 21 def error @error end |
#numbers ⇒ Array<Fixnum>
The message number(s) this message outcome is for. There will always be exactly one entry in this array except in the case where #error is a Errors::MessagesSkippedByTimeoutError in which case there may be more than one entry if multiple messages were skipped.
16 17 18 |
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 16 def numbers @numbers end |
#sequence ⇒ String
The name of the sequence this message outcome is for.
9 10 11 |
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 9 def sequence @sequence end |
Class Method Details
.parse(line) ⇒ Object
Attempts to parses the specified line as a message outcome message and returns an instance of Lightstreamer::SendMessageOutcomeMessage on success, or ‘nil` on failure.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lightstreamer/messages/send_message_outcome_message.rb', line 26 def parse(line) match = line.match Regexp.new '^MSG,([A-Za-z0-9_]+),(\d*),(?:DONE|ERR,(\d*),(.*))$' return unless match = new .sequence = match.captures[0] .numbers = [match.captures[1].to_i] handle_error_outcome , match.captures if match.captures.compact.size == 4 end |