View Source Bonfire.Epics.Act behaviour (Bonfire v0.9.10-classic-beta.169)
Represents an individual Act within an Epic.
An Act is a struct containing a module to be executed, options, and metadata.
This module provides functionality to create new Acts and define their behavior. See Bonfire.Epics
docs for an example Act.
Summary
Functions
Creates a new Act for the given module.
Creates a new Act for the given module, with options.
Creates a new Act for the given module, with options and metadata.
Types
@type ret() :: Bonfire.Epics.Epic.t() | t() | {:ok, Bonfire.Epics.Epic.t()} | {:ok, t()} | {:ok, Bonfire.Epics.Epic.t(), t()} | {:error, any()}
Represents an Act struct.
:module
- The module to be executed.:options
- A keyword list of options for the Act.:meta
- Any additional metadata for the Act.
Callbacks
@callback run(Bonfire.Epics.Epic.t(), t()) :: ret()
Callback for running an Act.
This function should be implemented by modules that define Acts.
Parameters
epic
: The current Epic struct.act
: The current Act struct.
Returns
The return value can be one of the following:
Epic.t()
Act.t()
{:ok, Epic.t()}
{:ok, Act.t()}
{:ok, Epic.t(), Act.t()}
{:error, any}
Functions
Creates a new Act for the given module.
Parameters
module
: The module to be executed.
Examples
iex> Bonfire.Epics.Act.new(MyActModule)
%Bonfire.Epics.Act{module: MyActModule, options: [], meta: nil}
Creates a new Act for the given module, with options.
Parameters
module
: The module to be executed.options
: A keyword list of options for the Act.
Examples
iex> Bonfire.Epics.Act.new(MyActModule, [option1: :value1])
%Bonfire.Epics.Act{module: MyActModule, options: [option1: :value1], meta: nil}
Creates a new Act for the given module, with options and metadata.
Parameters
module
: The module to be executed.options
: A keyword list of options for the Act.meta
: Any additional metadata for the Act.
Examples
iex> Bonfire.Epics.Act.new(MyActModule, [option1: :value1], %{extra: "data"})
%Bonfire.Epics.Act{module: MyActModule, options: [option1: :value1], meta: %{extra: "data"}}