class

Marten::Routing::Reverser

Inherits Reference / Object

Represents a route reverser.

A route reverser allows to perform URL / route lookups for a given route. Such routes can optionally expect parameters and such parameters are handled accordingly when the #reverse method is called. The main Marten::Routing::Map#reverse method makes use of reverser objects internally in order to perform routes lookups.

Constructors

new(name : String, path_for_interpolation : String, parameters : Hash(String, Marten::Routing::Parameter::Base) = {} of String => Parameter::Base)
Source
new(name : String, path_for_interpolations : Hash(String | Nil, String), parameters : Hash(String, Marten::Routing::Parameter::Base) = {} of String => Parameter::Base)
Source

Instance methods

combine(other : Reverser) : Reverser

Combines the current reverser with another reverser.

The new reverser will have a combined name, path, and parameters.

Source
name
Source
parameters
Source
path_for_interpolation

Returns the path for interpolation for the current locale.

Source
prefix_default_locale=(prefix_default_locale : Bool)
Source
prefix_default_locale?
Source
prefix_locales=(prefix_locales : Bool)
Source
prefix_locales?
Source
reverse(params : Nil | Hash(String | Symbol, Parameter::Types)) : String | Nil

Reverses the route for the given parameters.

If the parameters do not match the expected parameters for the route, nil is returned.

Source

Nested types