lib/angelo/server.rb in angelo-0.1.3 vs lib/angelo/server.rb in angelo-0.1.4
- old
+ new
@@ -2,12 +2,15 @@
require 'mime-types'
module Angelo
class Server < Reel::Server
+ extend Forwardable
include Celluloid::Logger
+ def_delegator :@base, :websockets
+
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)
@@ -18,9 +21,17 @@
connection.each_request do |request|
meth = request.websocket? ? :socket : request.method.downcase.to_sym
dispatch! meth, connection, request
end
# RubyProf.pause
+ end
+
+ def self.define_action name, &action
+ define_method name, &action
+ end
+
+ def self.remove_action name
+ remove_method name
end
private
def dispatch! meth, connection, request