Class: Lightstreamer::OverflowMessage
- Inherits:
-
Object
- Object
- Lightstreamer::OverflowMessage
- Defined in:
- lib/lightstreamer/messages/overflow_message.rb
Overview
Helper class used by Subscription in order to parse incoming overflow messages.
Instance Attribute Summary collapse
-
#item_index ⇒ Fixnum
The index of the item this overflow message applies to.
-
#overflow_size ⇒ Fixnum
The size of the overflow that occurred.
Class Method Summary collapse
-
.parse(line, table_id, items) ⇒ Object
Attempts to parses the specified line as an overflow message for the given table and items and returns an instance of OverflowMessage on success, or ‘nil` on failure.
Instance Attribute Details
#item_index ⇒ Fixnum
The index of the item this overflow message applies to.
9 10 11 |
# File 'lib/lightstreamer/messages/overflow_message.rb', line 9 def item_index @item_index end |
#overflow_size ⇒ Fixnum
The size of the overflow that occurred.
14 15 16 |
# File 'lib/lightstreamer/messages/overflow_message.rb', line 14 def overflow_size @overflow_size end |
Class Method Details
.parse(line, table_id, items) ⇒ Object
Attempts to parses the specified line as an overflow message for the given table and items and returns an instance of Lightstreamer::OverflowMessage on success, or ‘nil` on failure.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lightstreamer/messages/overflow_message.rb', line 19 def parse(line, table_id, items) match = line.match table_regexp(table_id) return unless match = new .item_index = match.captures[0].to_i - 1 return unless .item_index < items.size .overflow_size = match.captures[1].to_i end |