Routex.Utils (Routex v1.3.0-rc.1)
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 branch leaf from assigns.
Returns the AST to get the current branch leaf 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.
Helps setting the branch in the process dictionary.
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_leaf( Routex.Types.route() | map() | Plug.Conn.t() | Phoenix.Socket.t() | [integer(), ...] ) :: integer()
Returns the branch leaf from assigns.
@spec get_helper_ast(caller :: Routex.Types.env()) :: Routex.Types.ast()
Returns the AST to get the current branch leaf 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.
@spec process_put_branch(branch :: [integer(), ...]) :: integer()
@spec process_put_branch(branch :: integer()) :: integer()
Helps setting the branch in the process dictionary.
Example: As dispatch target
dispatch_targets: [{Routex.Utils, :process_put_branch, [[:attrs, :__branch__]]}]