Routex.Utils (Routex v1.2.2)
View SourceProvides an interface to functions which can be used in extensions.
Summary
Functions
Prints an alert. Should be used when printing critical alerts in the terminal during compile time.
Returns the module to use for LiveView assignments
Backward compatible version of Code.ensure_compiled!/1
Test env aware variant of Module.get_attribute. Delegates to
Module.get_attribute/3
in non-test environments. In test environment it
returns the result of Module.get_attribute/3
or an empty list when the
module is already compiled.
Returns the AST to get the current branch from process dict or from assigns, conn or socket
based on the available variables in the caller
module.
Prints an indented text. Should be used when printing messages in the terminal during compile time.
Functions
Prints an alert. Should be used when printing critical alerts in the terminal during compile time.
@spec assign_module() :: module()
Returns the module to use for LiveView assignments
Backward compatible version of Code.ensure_compiled!/1
Test env aware variant of Module.get_attribute. Delegates to
Module.get_attribute/3
in non-test environments. In test environment it
returns the result of Module.get_attribute/3
or an empty list when the
module is already compiled.
@spec get_branch(Routex.Types.route() | map() | Plug.Conn.t() | Phoenix.Socket.t()) :: integer()
@spec get_helper_ast(caller :: Routex.Types.env()) :: Routex.Types.ast()
Returns the AST to get the current branch from process dict or from assigns, conn or socket
based on the available variables in the caller
module.
Prints an indented text. Should be used when printing messages in the terminal during compile time.