RulEx.DataBag protocol (RulEx v1.0.0) View Source
Protocol controlling providing facts to RulEx evaluation functions.
Examples
defimpl RulEx.DataBag, for: Keyword do
def get(kw, key, default \\ nil) do
Keyword.get(kw, key, default)
end
end
Link to this section Summary
Functions
Given an term implementing the RulEx.DataBag
behaviour, a key,
and an optional default value, yield back the value found in
the provided databag.
Link to this section Types
Specs
t() :: term()
Link to this section Functions
Specs
Given an term implementing the RulEx.DataBag
behaviour, a key,
and an optional default value, yield back the value found in
the provided databag.
Examples
iex> 10 = RulEx.DataBag.get(%{"x" => 10}, "x")
iex> 10 = RulEx.DataBag.get(%{"x" => 10}, "x", 11)
iex> 11 = RulEx.DataBag.get(%{"y" => 10}, "x", 11)