Class: Lightstreamer::EndOfSnapshotMessage
- Inherits:
-
Object
- Object
- Lightstreamer::EndOfSnapshotMessage
- Defined in:
- lib/lightstreamer/messages/end_of_snapshot_message.rb
Overview
Helper class used by Subscription in order to parse incoming end-of-snapshot messages.
Instance Attribute Summary collapse
-
#item_index ⇒ Fixnum
The index of the item this end-of-snapshot message applies to.
Class Method Summary collapse
-
.parse(line, table_id, items) ⇒ Object
Attempts to parses the specified line as an end-of-snapshot message for the given table and items and returns an instance of EndOfSnapshotMessage on success, or ‘nil` on failure.
Instance Attribute Details
#item_index ⇒ Fixnum
The index of the item this end-of-snapshot message applies to.
9 10 11 |
# File 'lib/lightstreamer/messages/end_of_snapshot_message.rb', line 9 def item_index @item_index end |
Class Method Details
.parse(line, table_id, items) ⇒ Object
Attempts to parses the specified line as an end-of-snapshot message for the given table and items and returns an instance of Lightstreamer::EndOfSnapshotMessage on success, or ‘nil` on failure.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lightstreamer/messages/end_of_snapshot_message.rb', line 14 def parse(line, table_id, items) = new match = line.match Regexp.new("^#{table_id},(\\d+),EOS$") return unless match .item_index = match.captures[0].to_i - 1 return unless .item_index < items.size end |