View Source Bonfire.Epics.Act behaviour (Bonfire v0.9.10-classic-beta.156)

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

Types

t()

Represents an Act struct.

Callbacks

Callback for running an Act.

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()}
@type t() :: %Bonfire.Epics.Act{meta: any(), module: module(), options: Keyword.t()}

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

Link to this macro

debug(act, thing, label \\ "")

View Source (macro)

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}
Link to this function

new(module, options, meta)

View Source

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"}}