View Source Routex.Attrs (Phoenix Routes Extension Framework v0.3.0-alpha.4)

Provides an interface to access and update Routex attributes.

Extensions can make use of Routex.Attrs values provided by Routex itself, Routex backends and other extensions. As those values are attributes to a route, extension B can use values attributed to a route by extension A.

  • To make the availability of the attributes as predictable as possible, Routex uses a flat structure.
  • Extension developers are encouraged to put as much information into the attributes as possible.
  • Extensions should add any fallback/default they might use themselves to the attributes.

Summary

Functions

Removes non private fields from attrs. Input is either an opts map or a Route.

Get the value assigned to key from route's options or return default. When no key is provided, the function returns all options.

Get the value assigned to key from route's options or raise if key not found. Accepts an optional custom error_msg as third argument

Merge value into route's options.

Returns true when the provided key or attribute is private.

Assigns value to route's options.

Assigns value to key in route's options.

Updates the options of a route by applying given function.

Updates the value assigned to key of a route's options by applying given function.

Functions

Removes non private fields from attrs. Input is either an opts map or a Route.

Link to this function

get(route, key \\ nil, default \\ nil)

View Source

Get the value assigned to key from route's options or return default. When no key is provided, the function returns all options.

Link to this function

get!(route, key, error_msg \\ nil)

View Source

Get the value assigned to key from route's options or raise if key not found. Accepts an optional custom error_msg as third argument

Merge value into route's options.

@spec private?({atom(), any()} | atom()) :: boolean()

Returns true when the provided key or attribute is private.

Assigns value to route's options.

Assigns value to key in route's options.

Updates the options of a route by applying given function.

Updates the value assigned to key of a route's options by applying given function.