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 : Map, name : String | Symbol | Nil = nil) : Nil
Inserts a new path into the routes map.
-
#path(path : String, target : Marten::Handlers::Base.class, 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 a Marten::Routing::Map
instance. The <path, target> pair has an optional
name that will be prepended to each <path, target> pair inside the Marten::Routing::Map
.
Inserts a new path into the routes map.
The target associated with the considered path must be a handler (subclass of Marten::Handlers::Base
).
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.