123456789_123456789_123456789_123456789_123456789_

Module: EventMachine::Protocols::LineProtocol

Relationships & Source Files
Defined in: lib/em/protocols/line_protocol.rb

Overview

LineProtocol will parse out newline terminated strings from a receive_data stream

module Server include EM::P::LineProtocol

def receive_line(line) send_data("you said: #line") end end

Instance Method Summary

Instance Method Details

#receive_data(data)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/em/protocols/line_protocol.rb', line 17

def receive_data data
  (@buf ||= ''.dup) << data

  @buf.each_line do |line|
    if line[-1] == "\n"
      receive_line(line.chomp)
    else
      @buf = line
    end
  end
end

#receive_line(line)

Invoked with lines received over the network

[ GitHub ]

  
# File 'lib/em/protocols/line_protocol.rb', line 30

def receive_line(line)
  # stub
end