hare v0.2.2 Hare.Context.Result

This module defines the Hare.Context.Result that represents the result of a ran set of steps.

It contains the following fields:

  • steps - A list of maps that represent the result of each step
  • exports - The data exported by the context

Steps

The steps field keeps information about all steps in inverse order. The steps/1 function is provided to return them in the proper order.

Each step may have one of the following formats:

  1. On success: %{status: :success, config: step_config, info: info}
  2. On failure: %{status: :failure, config: step_config, reason: reason}
  3. When not run: %{status: :not_done, config: step_config}

Summary

Types

The possible formats of a step depending on whether it succeeded, failed or was not run

A list of pairs {module, result} representing a step

t()

Functions

Adds a failure step to the given result

Creates a new empty result

Adds a not_done step to the given result

Returns the step results in the order they ran in

Adds a success step to the given result, and updates exports

Types

config()
exports()
info()
step_mod()
step_mod() :: Hare.Context.Action.t
step_result()
step_result ::
  %{status: :success, config: config, info: info} |
  %{status: :failure, config: config, reason: reason :: term} |
  %{status: :not_done, config: config}

The possible formats of a step depending on whether it succeeded, failed or was not run.

steps()
steps() :: [{step_mod, step_result}]

A list of pairs {module, result} representing a step.

t()
t() :: %Hare.Context.Result{exports: exports, steps: [{step_mod, step_result}]}

Functions

failure(result, mod, config, reason)
failure(t, step_mod, config, reason :: term) :: t

Adds a failure step to the given result.

new()
new() :: t

Creates a new empty result.

not_done(result, mod, config)
not_done(t, step_mod, config) :: t

Adds a not_done step to the given result.

steps(result)
steps(t) :: steps

Returns the step results in the order they ran in.

success(result, mod, config, info, new_exports)
success(t, step_mod, config, info, exports) :: t

Adds a success step to the given result, and updates exports.