Skip to content

class Athena::Routing::Matcher::URLMatcher
inherits Reference #

Default implementation of ART::Matcher::RequestMatcherInterface and ART::Matcher::URLMatcherInterface.

Included modules

Athena::Routing::Matcher::RequestMatcherInterface Athena::Routing::Matcher::URLMatcherInterface

Direct known subclasses

Athena::Routing::Matcher::TraceableURLMatcher

Constructors#

.new(context : ART::RequestContext, route_provider : ART::RouteProvider.class = ART::RouteProvider)#

View source

Methods#

#context : ART::RequestContext#

Returns the request context.

View source

#context=(context : ART::RequestContext)#

Sets the request context.

View source

#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.

View source

#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.

View source

#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.

View source

#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.

View source