class Lightstreamer::EndOfSnapshotMessage

Helper class used by {Subscription} in order to parse incoming end-of-snapshot messages.

@private

Attributes

item_index[RW]

The index of the item this end-of-snapshot message applies to.

@return [Fixnum]

Public Class Methods

parse(line, table_id, items) click to toggle source

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.

# File lib/lightstreamer/messages/end_of_snapshot_message.rb, line 14
def parse(line, table_id, items)
  message = new

  match = line.match Regexp.new("^#{table_id},(\\d+),EOS$")
  return unless match

  message.item_index = match.captures[0].to_i - 1
  return unless message.item_index < items.size

  message
end