Sha256: d5096c23c2527fb910122f5d95e6b3a11e1846e61811250ba3916bd6acdfef56
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 Bytes
Contents
module Angelo class Server < Reel::Server include Celluloid::Logger def initialize base, host = '127.0.0.1', port = 4567 @base = base info "Angelo #{VERSION}" info "listening on #{host}:#{port}" super host, port, &method(:on_connection) end def on_connection connection # RubyProf.resume connection.each_request do |request| meth = request.websocket? ? :socket : request.method.downcase.to_sym route! meth, connection, request end # RubyProf.pause end private def route! meth, connection, request rs = @base.routes[meth][request.path] if rs responder = rs.dup responder.base = @base.new responder.connection = connection responder.request = request else Angelo.log connection, request, nil, :not_found connection.respond :not_found, DEFAULT_RESPONSE_HEADERS, NOT_FOUND end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
angelo-0.1.1 | lib/angelo/server.rb |
angelo-0.1.0 | lib/angelo/server.rb |