Fledex.Utils.Dsl (fledex v0.5.0)
View SourceSummary
Functions
This function takes an ast function block and adds an argument
to the function. This is different from ast_add_argument_to_func_if_missing/1
that it does not expect there to be an arugment and therefore will raise an
ArgumentError
if it does find one.
This function takes an AST block of a function, checks whether
the required parameter (trigger
) is present, and if not will
add one.
This function is to decide on whether ast_create_anonymous_func/1
or ast_create_anonymous_func/2
should be called
This function takes an AST of a function body and wraps it into an anonymous function. It does expect that the arguments are handled as part of the function body, e.g. the function body should look something like this
This function is similar to ast_create_anonymous_func/1
, except that no
argument was specified in the block (because the user does not want to use it),
even though the function should have one.
The function will make sure to add the argument to the block before wrapping
it into an anonymous function.
Functions
@spec apply_effect( atom(), keyword(), Fledex.Animation.Manager.configs_t() | [Fledex.Animation.Manager.configs_t()] ) :: Fledex.Animation.Manager.configs_t()
This function takes an ast function block and adds an argument
to the function. This is different from ast_add_argument_to_func_if_missing/1
that it does not expect there to be an arugment and therefore will raise an
ArgumentError
if it does find one.
This function takes an AST block of a function, checks whether
the required parameter (trigger
) is present, and if not will
add one.
This function is to decide on whether ast_create_anonymous_func/1
or ast_create_anonymous_func/2
should be called
NOTE: this function makes the assumption that a single argument is
required.
@spec ast_create_anonymous_func([{:->, list(), [[atom()] | any()]}]) :: {:fn, [], [{:->, list(), [[atom()] | any()]}]}
This function takes an AST of a function body and wraps it into an anonymous function. It does expect that the arguments are handled as part of the function body, e.g. the function body should look something like this:
arg1 -> :ok
arg1, arg2 -> :ok
This function is similar to ast_create_anonymous_func/1
, except that no
argument was specified in the block (because the user does not want to use it),
even though the function should have one.
The function will make sure to add the argument to the block before wrapping
it into an anonymous function.
@spec configure_strip( atom(), :config | module() | {module(), keyword()} | [{module(), keyword()}], keyword(), [Fledex.Animation.Manager.configs_t()] | Fledex.Animation.Manager.configs_t() ) :: :ok | Fledex.Animation.Manager.configs_t()
@spec create_config(atom(), atom(), keyword() | nil) :: Fledex.Animation.Manager.configs_t()
@spec create_config(atom(), atom(), (map() -> Fledex.Leds.t()), keyword() | nil) :: Fledex.Animation.Manager.configs_t()