Delx v3.0.0 Delx.Defdelegate View Source

A module defining a macro to define delegate functions.

Link to this section Summary

Functions

You can delegate functions calls to another module by using the Delx module and calling the defdelegate/2 macro in the module body. It has the same API as Elixir's own Kernel.defdelegate/2 macro.

Link to this section Functions

Link to this macro

defdelegate(funs, opts) View Source (macro)

You can delegate functions calls to another module by using the Delx module and calling the defdelegate/2 macro in the module body. It has the same API as Elixir's own Kernel.defdelegate/2 macro.

Example

Before calling defdelegate/2, you need to use Delx.

iex> defmodule Greeter do
...>   use Delx, otp_app: :greeter

...>   defdelegate hello(name), to: Greeter.StringGreeter, as: :welcome
...> end