Sha256: 62a1541ec56d928c5b86ee6226cd291555d3c22a7fcf07335c0145a154e6e254

Contents?: true

Size: 802 Bytes

Versions: 13

Compression:

Stored size: 802 Bytes

Contents

require 'deas/sinatra_runner'

module Deas
  class Route

    attr_reader :method, :path, :handler_proxy, :handler_class

    def initialize(method, path, handler_proxy)
      @method, @path, @handler_proxy = method, path, handler_proxy
    end

    def validate!
      @handler_class = @handler_proxy.handler_class
    end

    # TODO: unit test this??
    def run(sinatra_call)
      sinatra_call.request.env.tap do |env|
        env['sinatra.params']          = sinatra_call.params
        env['deas.handler_class_name'] = self.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(self.handler_class, sinatra_call)
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deas-0.24.0 lib/deas/route.rb
deas-0.23.4 lib/deas/route.rb
deas-0.23.3 lib/deas/route.rb
deas-0.23.2 lib/deas/route.rb
deas-0.23.1 lib/deas/route.rb
deas-0.23.0 lib/deas/route.rb
deas-0.22.1 lib/deas/route.rb
deas-0.22.0 lib/deas/route.rb
deas-0.21.0 lib/deas/route.rb
deas-0.20.0 lib/deas/route.rb
deas-0.19.0 lib/deas/route.rb
deas-0.18.0 lib/deas/route.rb
deas-0.17.1 lib/deas/route.rb