Module: Otaku::Server::EM

Defined in:
lib/otaku/server.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#log(*msgs) ⇒ Object



57
58
59
# File 'lib/otaku/server.rb', line 57

def log(*msgs)
  Otaku.log(msgs)
end

#process_data(data) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/otaku/server.rb', line 47

def process_data(data)
  begin
    Server.handler.process(data)
  rescue
    error = DataProcessError.new($!.inspect)
    log(error.inspect)
    error
  end
end

#receive_data(data) ⇒ Object



40
41
42
43
44
45
# File 'lib/otaku/server.rb', line 40

def receive_data(data)
  log 'receives data: %s' % data.inspect
  result = process_data(data)
  log 'returning result: %s' % result.inspect
  send_data(Encoder.encode(result))
end