Class: EventMachine::Http::MonitorFactory::StreamOutputter

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http-monitor.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ StreamOutputter

Returns a new instance of StreamOutputter.



148
149
150
151
# File 'lib/em-http-monitor.rb', line 148

def initialize(stream)
  @stream = stream
  @stream.sync = true
end

Instance Method Details

#receive(client, data) ⇒ Object



159
160
161
162
163
# File 'lib/em-http-monitor.rb', line 159

def receive(client, data)
  @stream << "#{client.object_id} << #{data}"
  @stream << "\n" unless data[-1] == 13 or data[-1] == 10
  true
end

#send(client, data) ⇒ Object



153
154
155
156
157
# File 'lib/em-http-monitor.rb', line 153

def send(client, data)
  @stream << "#{client.object_id} >> #{data}"
  @stream << "\n" unless data[-1] == 13 or data[-1] == 10
  true
end