class Kingfisher::Router

Public Instance Methods

call(env) click to toggle source
# File lib/kingfisher/router.rb, line 5
def call(env)
  request = Rack::Request.new(env)

  if csrf(request).unsafe?
    forbidden
  else
    route(request).call(env)
  end
end

Private Instance Methods

csrf(request) click to toggle source
# File lib/kingfisher/router.rb, line 41
def csrf(request)
  @_csrf ||= CSRF.new(request)
end
delete(url, controller, action) click to toggle source
# File lib/kingfisher/router.rb, line 33
def delete(url, controller, action)
  route_set.delete(url, controller, action)
end
forbidden() click to toggle source
# File lib/kingfisher/router.rb, line 37
def forbidden
  [403, {"Content-Type" => "text/plain"}, ["Forbidden"]]
end
get(url, controller, action) click to toggle source
# File lib/kingfisher/router.rb, line 25
def get(url, controller, action)
  route_set.get(url, controller, action)
end
post(url, controller, action) click to toggle source
# File lib/kingfisher/router.rb, line 29
def post(url, controller, action)
  route_set.post(url, controller, action)
end
route(request) click to toggle source
# File lib/kingfisher/router.rb, line 21
def route(request)
  route_set.match(request)
end
route_set() click to toggle source
# File lib/kingfisher/router.rb, line 17
def route_set
  @_route_set ||= RouteSet.new
end