Class: Servent::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/servent/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Stream

Returns a new instance of Stream.



5
6
7
8
9
# File 'lib/servent/stream.rb', line 5

def initialize(stream)
  @stream = StringIO.new stream
  @buffer = []
  @events = []
end

Instance Attribute Details

#last_event_idObject (readonly)

Returns the value of attribute last_event_id.



3
4
5
# File 'lib/servent/stream.rb', line 3

def last_event_id
  @last_event_id
end

#reconnection_timeObject (readonly)

Returns the value of attribute reconnection_time.



3
4
5
# File 'lib/servent/stream.rb', line 3

def reconnection_time
  @reconnection_time
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
# File 'lib/servent/stream.rb', line 11

def parse
  @stream.each_line { |line|
    next if line.start_with?(Servent::COLON)
    handle_line line
  }
  complete_event
  @events
end