Interceptor.Configurator (interceptor v0.5.4) View Source

Link to this section Summary

Functions

This function converts a map or a list of 2-element tuples (i.e. any structure that can be iterated with Enum.map/2 as a list of 2-element tuples) into a "proper" (i.e. tuple-based) intercept configuration map. Each element is a {mfa_to_intercept, callbacks} tuple, where mfa_to_intercept is the MFA of the function to intercept as a "Module.function/arity" string, and callbacks is a keyword list whose keys may be one of :before, :after, :on_success, :on_error or :wrapper, and the values the callback functions to call also as a "Module.function/arity" string.

Link to this section Functions

Link to this macro

intercept(mfa_to_intercept, callbacks)

View Source (macro)
Link to this function

transform_streamlined_config_to_tuple_config(intercept_config)

View Source

This function converts a map or a list of 2-element tuples (i.e. any structure that can be iterated with Enum.map/2 as a list of 2-element tuples) into a "proper" (i.e. tuple-based) intercept configuration map. Each element is a {mfa_to_intercept, callbacks} tuple, where mfa_to_intercept is the MFA of the function to intercept as a "Module.function/arity" string, and callbacks is a keyword list whose keys may be one of :before, :after, :on_success, :on_error or :wrapper, and the values the callback functions to call also as a "Module.function/arity" string.

If instead of a "Module.function/arity" string, a function is already in the MFA tuple format, i.e., it is already written as {Module, :function, 2}, instead of "Module.function/2", the transformation won't do nothing.

The intercepted function can now have a * for its arity or function_name and arity on both tuple-based and string-based format (e.g. {Module, :*, :*} or Module.*/*).