ExMachine.Context (ex_machine v0.1.0)

View Source

Summary

Functions

Delete a key from the context. Same as Map.delete/2, useful because its imported in state module

Get the value of key in context. Same as Map.get/3, useful because its imported in state module

Puts the given value under key in context. Same as Map.put/3, useful because its imported in state module

Puts the given term under the event params key in context.

Raise an internal event during the execution of an action

Functions

delete(context, key)

Delete a key from the context. Same as Map.delete/2, useful because its imported in state module

Examples

iex> context = put(%{}, :hello, :world)
iex> context[:hello]
:world
iex> context = delete(context, :hello)
iex> context[:hello]
nil

delete_params(context)

get(context, key, default \\ nil)

Get the value of key in context. Same as Map.get/3, useful because its imported in state module

Examples

iex> context = put(%{}, :hello, :world)
iex> get(context, :hello)
:world

get_params(context)

put(context, key, value)

Puts the given value under key in context. Same as Map.put/3, useful because its imported in state module

Examples

iex> context = put(%{}, :hello, :world)
iex> context[:hello]
:world

put_params(context, params)

Puts the given term under the event params key in context.

raise_event(context, event)

Raise an internal event during the execution of an action