patch v0.2.0 Patch.Function View Source

For simple patching the caller can just patch a function, ignore the arguments, and always return a value. This module helps create anonymous functions that accept (and ignore) the requested number of arguments and always return the static value.

This module was autogenerated, it contains 255 for_arity/2 clauses that all behave identically only differing in the number of arguments the anonymous function accepts.

mix format wants this to be several thousand lines long, so it's getting put over here to keep the main Patch module small and easy to read.

TODO: Find a better way to do this.

Link to this section Summary

Functions

Generate an anonymous function of the arity provided that ignores all arguments and returns the provided return_value.

Link to this section Functions

Link to this function

for_arity(int, return_value)

View Source
for_arity(arity :: non_neg_integer(), return_value :: term()) :: (... -> any())

Generate an anonymous function of the arity provided that ignores all arguments and returns the provided return_value.

BEAM only supports functions of arity /0 though /254.