Sha256: eb3c92ec5cd0c063a2804227a43e22f860ebce48b15929fb9a3b38c073484d9c

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

require "mgt/version"
require "mgt/util"
require "mgt/dependencies"
require "mgt/base_controller"
require "routing/router"
require "routing/route"
require "routing/mapper"
require "orm/active_record"
require "orm/database"
require "orm/query_generator"

module Mgt
  class Application
    attr_reader :routes

    def initialize
      @routes = Routing::Router.new
    end

    def call(env)
      @request = Rack::Request.new(env)
      route = mapper.map_to_route(@request)

      if route
        route.dispatch
      else
        [404, {}, ["Page not found"]]
      end
    end

    def mapper
      @mapper ||= Routing::Mapper.new(routes.endpoints)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mgt-0.1.0 lib/mgt.rb