class Athena::Routing::Router
inherits Reference
#
Included modules
Athena::Routing::Matcher::RequestMatcherInterface
Athena::Routing::RouterInterface
Constructors#
.new(route_collection : ART::RouteCollection, default_locale : String | Nil = nil, strict_requirements : Bool | Nil = true, context : ART::RequestContext | Nil = nil)
#
Methods#
#generate(route : String, params : Hash(String, String | Nil) = Hash(String, String | ::Nil).new, reference_type : ART::Generator::ReferenceType = :absolute_path) : String
#
Generates a URL for the provided route, optionally with the provided params and reference_type.
#generate(route : String, reference_type : ART::Generator::ReferenceType = :absolute_path, **params) : String
#
Generates a URL for the provided route, optionally with the provided params and reference_type.
#match(path : String) : Hash(String, String | Nil)
#
Tries to match the provided path to its related route. Returns a hash of the route's defaults and parameters resolved from the path.
Raises an ART::Exception::ResourceNotFound
if no route could be matched.
Raises an ART::Exception::MethodNotAllowed
if a route exists but not for the current HTTP method.
#match(request : ART::Request) : Hash(String, String | Nil)
#
Tries to match the provided request to its related route. Returns a hash of the route's defaults and parameters resolved from the request.
Raises an ART::Exception::ResourceNotFound
if no route could be matched.
Raises an ART::Exception::MethodNotAllowed
if a route exists but not for the request's method.
#match?(path : String) : Hash(String, String | Nil) | Nil
#
Tries to match the provided path to its related route. Returns a hash of the route's defaults and parameters resolved from the path.
Returns nil
if no route could be matched or a route exists but not for the current HTTP method.
#match?(request : ART::Request) : Hash(String, String | Nil) | Nil
#
Tries to match the provided request to its related route. Returns a hash of the route's defaults and parameters resolved from the request.
Returns nil
if no route could be matched or a route exists but not for the request's method.