Mixin for Elixir.
Delegates all functions to ModuleA from moduleB.
Works like a so-called Mixin
.
def deps do
[
{:mixin, "~> 0.1.0"}
]
end
iex> defmodele ForDocFoo do
...> def foo, do: :foo
...> end
iex> defmodele ForDocBar do
...> require Mixin
...> Mixin.include ForDocFoo
...> end
iex> ForDocBar.foo
:foo
When import/2.
iex> defmodule A do
...> def a do
...> :a
...> end
...> end
iex> defmodule B do
...> import A
...> end
iex> B.a()
** (UndefinedFunctionError) function B.a/0 is undefined or private
** When Mixin.include. **
iex> defmodule A do
...> def a do
...> :a
...> end
...> end
iex> defmodule B do
...> require Mixin
...> Mixin.include A
...> end
iex> B.a()
:a