Method: Lightstreamer::OverflowMessage.parse

Defined in:
lib/lightstreamer/messages/overflow_message.rb

.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

  message = new

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

  message.overflow_size = match.captures[1].to_i

  message
end