class Rollerskates::Application

Attributes

routes[R]

Public Class Methods

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

Public Instance Methods

call(env) click to toggle source
# File lib/rollerskates/application.rb, line 9
def call(env)
  @request = Rack::Request.new(env)
  route = mapper.map_to_route(@request)
  if route
    response = route.dispatch
    return response.finish(route.method_name)
  end
  [404, {}, ["Route not found"]]
end
mapper() click to toggle source
# File lib/rollerskates/application.rb, line 19
def mapper
  @mapper ||= Routing::Mapper.new(routes.endpoints)
end