Class: Angelo::Server
- Inherits:
-
Reel::Server::HTTP
- Object
- Reel::Server::HTTP
- Angelo::Server
- Extended by:
- Forwardable
- Includes:
- Celluloid::Internals::Logger
- Defined in:
- lib/angelo/server.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(base, addr = nil, port = nil, options = {}) ⇒ Server
constructor
A new instance of Server.
- #on_connection(connection) ⇒ Object
Constructor Details
#initialize(base, addr = nil, port = nil, options = {}) ⇒ Server
Returns a new instance of Server.
14 15 16 17 18 19 20 21 |
# File 'lib/angelo/server.rb', line 14 def initialize base, addr = nil, port = nil, = {} @base = base addr ||= @base.addr port ||= @base.port info "Angelo #{VERSION}" info "listening on #{addr}:#{port}" super addr, port, , &method(:on_connection) end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
12 13 14 |
# File 'lib/angelo/server.rb', line 12 def base @base end |
Class Method Details
.define_task(name, &action) ⇒ Object
37 38 39 |
# File 'lib/angelo/server.rb', line 37 def self.define_task name, &action define_method name, &action end |
.remove_task(name) ⇒ Object
41 42 43 |
# File 'lib/angelo/server.rb', line 41 def self.remove_task name remove_method name end |
Instance Method Details
#on_connection(connection) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/angelo/server.rb', line 23 def on_connection connection # RubyProf.resume responders = [] connection.each_request do |request| meth = request.websocket? ? :websocket : request.method.downcase.to_sym responder = dispatch! meth, connection, request responders << responder if responder and responder.respond_to? :on_close end responders.each &:on_close # RubyProf.pause end |