class Marten::Routing::Map
- Marten::Routing::Map
- Reference
- Object
Defined in:
marten/routing/map.crConstructors
Class Method Summary
Instance Method Summary
- #draw(&)
-
#path(path : String, target : Marten::Handlers::Base.class | Map, name : String | Symbol) : Nil
Inserts a new path into the routes map.
-
#resolve(path : String) : Match
Resolves a path - identify a route matching a specific path.
-
#reverse(name : String | Symbol, params : Hash(String | Symbol, Parameter::Types))
Reverses a URL - returns the URL corresponding to a specific route name and hash of parameters.
-
#reverse(name : String | Symbol, **kwargs) : String
Reverses a URL - returns the URL corresponding to a specific route name and parameters.
- #rules : Array(Marten::Routing::Rule::Base)
Constructor Detail
Class Method Detail
Instance Method Detail
Inserts a new path into the routes map.
The target associated with the considered path must be either a handler (subclass of Marten::Handlers::Base
)
or another Marten::Routing::Map
instance (in case of nested routes maps). Each <path, target> pair must be
given a name that will be used to uniquely identify the route.
Resolves a path - identify a route matching a specific path.
The route resolution process tries to identify which handler corresponds to the considered path and returns a
Marten::Routing::Match
object if a match is found. If no match is found a
Marten::Routing::Errors::NoResolveMatch
exception is raised.
Reverses a URL - returns the URL corresponding to a specific route name and hash of parameters.
The URL lookup mechanism tries to identify the route matching the given name and tries to apply the parameters
defined in the parameters hash passed in the method call. If no route is found or if the arguments can't be
applied to the route, a Marten::Routing::Errors::NoReverseMatch
exception is raised.
Reverses a URL - returns the URL corresponding to a specific route name and parameters.
The URL lookup mechanism tries to identify the route matching the given name and tries to apply any extra
parameters passed in the method call. If no route is found or if the arguments can't be applied to the route, a
Marten::Routing::Errors::NoReverseMatch
exception is raised.