Liquex.Context (liquex v0.8.0) View Source

Stores contextual information for the parser

Link to this section Summary

Functions

Assign a new variable to the context

Callback implementation for Access.fetch/2.

Create a new Context using predefined variables map

Callback implementation for Access.pop/2.

Assign an error to the error logs

Link to this section Types

Specs

t() :: %Liquex.Context{
  cycles: map(),
  environment: map(),
  errors: [Liquex.Error.t()],
  filter_module: module(),
  private: map(),
  render_module: module() | nil,
  scope: Liquex.Scope.t()
}

Link to this section Functions

Link to this function

assign(context, key, value)

View Source

Specs

assign(t(), String.t() | atom(), any()) :: t()

Assign a new variable to the context

Set a variable named key with the given value in the current context

Link to this function

assign_global(context, key, value)

View Source

Callback implementation for Access.fetch/2.

Link to this function

get(context, key, default \\ nil)

View Source
Link to this function

get_and_update(context, key, function)

View Source

Callback implementation for Access.get_and_update/3.

Link to this function

new(environment, opts \\ [])

View Source

Specs

new(map(), Keyword.t()) :: t()

Create a new Context using predefined variables map

Returns a new, initialized context object

Callback implementation for Access.pop/2.

Link to this function

push_error(context, error)

View Source

Specs

push_error(
  t(),
  struct()
) :: t()

Assign an error to the error logs

Link to this function

push_scope(context, new_scope \\ %{})

View Source