lib/deas/route.rb in deas-0.9.0 vs lib/deas/route.rb in deas-0.10.0

- old
+ new

@@ -3,26 +3,26 @@ module Deas class Route attr_reader :method, :path, :handler_class_name, :handler_class - def initialize(method, path, handler_class_name) + def initialize(method, path, handler_class_name, handler_class = nil) @method = method @path = path @handler_class_name = handler_class_name - @handler_class = nil + @handler_class = handler_class end def constantize! @handler_class ||= constantize_name(handler_class_name) raise(NoHandlerClassError.new(handler_class_name)) if !@handler_class end def run(sinatra_call) sinatra_call.request.env.tap do |env| - env['sinatra.params'] = sinatra_call.params - env['deas.handler_class'] = @handler_class - env['deas.logging'].call " Handler: #{env['deas.handler_class']}" + env['sinatra.params'] = sinatra_call.params + env['deas.handler_class_name'] = @handler_class_name + env['deas.logging'].call " Handler: #{env['deas.handler_class_name']}" env['deas.logging'].call " Params: #{env['sinatra.params'].inspect}" end Deas::SinatraRunner.run(@handler_class, sinatra_call) end