lib/angelo/base.rb in angelo-0.3.2 vs lib/angelo/base.rb in angelo-0.3.3
- old
+ new
@@ -4,11 +4,11 @@
include ParamsParser
include Celluloid::Logger
extend Forwardable
def_delegators :@responder, :content_type, :headers, :redirect, :request, :transfer_encoding
- def_delegators :@klass, :report_errors?, :sse_event, :sse_message, :sses, :websockets
+ def_delegators :@klass, :public_dir, :report_errors?, :sse_event, :sse_message, :sses, :websockets
attr_accessor :responder
class << self
@@ -86,15 +86,11 @@
remove_method name
method
end
def routes
- @routes ||= {}
- ROUTABLE.each do |m|
- @routes[m] ||= {}
- end
- @routes
+ @routes ||= Hash.new{|h,k| h[k] = {}}
end
def filters
@filters ||= {before: {default: []}, after: {default: []}}
end
@@ -162,16 +158,16 @@
def content_type type
Responder.content_type type
end
- def run! _addr = addr, _port = port
- run _addr, _port, true
+ def run! _addr = addr, _port = port, options = {}
+ run _addr, _port, options, true
end
- def run _addr = addr, _port = port, blocking = false
+ def run _addr = addr, _port = port, options = {}, blocking = false
Celluloid.logger.level = log_level
- @server = Angelo::Server.new self, _addr, _port
+ @server = Angelo::Server.new self, _addr, _port, options
@server.async.ping_websockets
if blocking
trap "INT" do
@server.terminate if @server and @server.alive?
exit