Sha256: b622ffcd2800d36486251941443110667f529b7923fe1f3fc14fb653f49a4880
Contents?: true
Size: 836 Bytes
Versions: 16
Compression:
Stored size: 836 Bytes
Contents
module GameServer::Client include DaemonLogger::Mixins def receive_request(request) find_controller(request.name).new(self, request).run rescue Exception => e log_exception e end def send_line(string) log "send_line #{string}\n" send_data(string + "\n") end def send_json(object) send_line object.to_json end def receive_data(data) @data ||= "" @data += data if data =~ /\000\n$/ all_data = @data @data = "" all_data.gsub!("\000",'').split(/\n/).each do |string| request = GameServer::RequestParser.new(string).parse receive_request(request) end end end def find_controller(name) "#{self.class.name}::#{name.to_s.camelize}Controller".constantize rescue NameError "#{self.class.name}::NilController".constantize end end
Version data entries
16 entries across 16 versions & 1 rubygems