Created
April 27, 2024 19:17
-
-
Save Wigny/cdd8f631932fce9188cfa4cce1e0613e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmacro delegate_functions_for(module, functions) do | |
for {fun_name, fun_arity} <- functions do | |
fun_args = Macro.generate_arguments(fun_arity, Macro.expand_literals(module, __CALLER__)) | |
quote do | |
defdelegate unquote(fun_name)(unquote_splicing(fun_args)), to: unquote(module) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment