Otera.Namespace (otera v0.1.0)

Copy Markdown View Source

A namespace() object of Jinja2, which a template can change.

{% set ns.count = ns.count + 1 %} changes the namespace everywhere it is referenced, also from inside a loop or a macro. The attributes live in Otera.State.

Summary

Functions

Returns the attributes of namespace as a dict.

Returns {:ok, value} for the attribute name, or :error.

Returns the attribute name, or an undefined value.

Makes a namespace with the attributes of dict.

Sets the attribute name to value.

Types

t()

@type t() :: %Otera.Namespace{ref: reference()}

Functions

attributes(namespace)

@spec attributes(t()) :: Otera.Dict.t()

Returns the attributes of namespace as a dict.

fetch(namespace, name)

@spec fetch(t(), String.t()) :: {:ok, term()} | :error

Returns {:ok, value} for the attribute name, or :error.

get(namespace, name)

@spec get(t(), String.t()) :: term()

Returns the attribute name, or an undefined value.

new(attributes)

@spec new(Otera.Dict.t()) :: t()

Makes a namespace with the attributes of dict.

put(namespace, name, value)

@spec put(t(), String.t(), term()) :: :ok

Sets the attribute name to value.