trunk v0.0.1 Trunk.State

This module defines a Trunk.State struct and provides some helper functions for working with that state.

Link to this section Summary

Functions

Assigns a value to a key on the state

Puts an error into the error map

Link to this section Types

Link to this type t()
t() :: %Trunk.State{assigns: map, async: boolean, errors: Keyword.t, extname: String.t, filename: String.t, module: atom, opts: Keyword.t, path: String.t, rootname: String.t, scope: map | struct, storage: atom, storage_opts: Keyword.t, version_timeout: integer, versions: [atom] | Keyword.t}

Link to this section Functions

Link to this function assign(state, key, value)
assign(state :: Trunk.State.t, key :: any, value :: any) :: map

Assigns a value to a key on the state.

Example:

iex> state.assigns[:hello]
nil
iex> state = assign(state, :hello, :world)
iex> state.assigns[:hello]
:world
Link to this function init(info, scope, opts)
Link to this function put_error(state, version, stage, error)

Puts an error into the error map.

Example:

iex> state.errors
nil
iex> state = put_error(state, :thumb, :transform, "Error with convert blah blah")
iex> state.errors
%{thumb: [transform: "Error with convert blah blah"]}