class Mgt::Application

Attributes

routes[R]

Public Class Methods

new() click to toggle source
# File lib/mgt.rb, line 16
def initialize
  @routes = Routing::Router.new
end

Public Instance Methods

call(env) click to toggle source
# File lib/mgt.rb, line 20
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
mapper() click to toggle source
# File lib/mgt.rb, line 31
def mapper
  @mapper ||= Routing::Mapper.new(routes.endpoints)
end