Records every event, newest last.
For tests that assert on what the engine did rather than on what it holds. It keeps everything and grows without bound, so do not leave it attached to a long-lived session.
Summary
Functions
Only the events matching a tag, in order.
The events a session recorded, in the order they happened.
Functions
@spec by_tag(Rete.Session.t(), atom()) :: [Rete.Listener.event()]
Only the events matching a tag, in order.
iex> alias Rete.{Listener.Collect, Session}
iex> Session.new([Rete.Doc.Orders])
...> |> Session.with_listener(Collect, [])
...> |> Session.insert([{:customer, 1}, {:order, 1, 250}])
...> |> Session.fire_rules()
...> |> Collect.by_tag(:activation_fired)
...> |> Enum.map(fn {_tag, source, _token, facts} -> {source.rule, facts} end)
[{{Rete.Doc.Orders, :large_order}, [{:flagged, 1, 250}]}]
@spec events(Rete.Session.t()) :: [Rete.Listener.event()]
The events a session recorded, in the order they happened.
iex> Rete.Session.new([Rete.Doc.Orders]) |> Rete.Listener.Collect.events()
[]