classy_hook ¶Module responsible for managing the hooks.
-spec first_match(hookpoint(), list()) -> {ok, _Val} |
undefined.
Return result of the first hook that returned {ok, _} for
a given set of arguments.
-spec all(hookpoint(), list()) -> ok | {error, _}.
Ensure that all functions hooked into Hookpoint return ok.
If any function returns other value or throws an exception,
this function returns {error, _}.
-spec fold(hookpoint(), list(), A) -> A.
Fold over all functions registered in Hookpoint.
Accumulator argument is appended to the Args list.
Errors are ignored (logged).
-spec foreach(hookpoint(), list()) -> ok.
Apply all functions hooked into Hookpoint to arguments Args.
Errors are ignored (logged).
-spec unhook(hook()) -> ok.
Remove a previously inserted hook.
-spec insert(hookpoint(), fun(), prio()) -> hook().