class Kingfisher::RouteSet

Public Class Methods

new() click to toggle source
# File lib/kingfisher/route_set.rb, line 3
def initialize
  @routes = []
end

Public Instance Methods

delete(url, controller, action) click to toggle source
# File lib/kingfisher/route_set.rb, line 20
def delete(url, controller, action)
  @routes << Route.new(:delete, url, controller, action)
end
get(url, controller, action) click to toggle source
# File lib/kingfisher/route_set.rb, line 12
def get(url, controller, action)
  @routes << Route.new(:get, url, controller, action)
end
match(request) click to toggle source
# File lib/kingfisher/route_set.rb, line 7
def match(request)
  mroute = @routes.find { |route| route.match?(request) }
  Operation.either(->(_){ raise NoRouteError, "#{request.request_method} #{request.path}" }, mroute).result
end
post(url, controller, action) click to toggle source
# File lib/kingfisher/route_set.rb, line 16
def post(url, controller, action)
  @routes << Route.new(:post, url, controller, action)
end