View Source Routex.Extension.AttrGetters (Phoenix Routes Extension Framework v0.1.0-alpha.4)
Creates helper functions to get the Routex.Attrs
given a binary url or a
list of path segments. This way the attributes for route can be lazily
loaded.
configuration
Configuration
# file /lib/example_web/routex_backend.ex
defmodule ExampleWeb.RoutexBackend do
use Routex,
extensions: [
+ Routex.Extension.AttrGetters,
],
routex-attrs
Routex.Attrs
Requires
- none
Sets
- none
helpers
Helpers
- attrs(url :: binary) :: map()
- attrs(segments :: list) :: map()
Example
iex> ExampleWeb.Router.RoutexHelpers.attrs("/europe/nl/producten/?foo=baz")
%{
__line__: 28,
__order__: [0, 9, 3],
__origin__: "/products",
backend: ExampleWeb.LocalizedRoutes,
contact: "verkoop@example.nl",
locale: "nl",
scope_name: "The Netherlands",
scope_helper: "europe_nl",
}