module EventMachine::Protocols::LineProtocol

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

Public Instance Methods

receive_data(data) click to toggle source

@private

# File lib/em/protocols/line_protocol.rb, line 15
def receive_data data
  (@buf ||= '') << data

  while @buf.slice!(/(.*?)\r?\n/)
    receive_line($1)
  end
end
receive_line(line) click to toggle source

Invoked with lines received over the network

# File lib/em/protocols/line_protocol.rb, line 24
def receive_line(line)
  # stub
end