View Source
Rephex.Util
(rephex v0.1.1)
Summary
defmodule BehaviourA do
@callback foo(any(), any()) :: any()
@optional_callbacks foo: 2
end
defmodule BehaviourAImpl do
@behaviour BehaviourA
end
defmodule User do
def call_foo() do
{:ok, :but_not_impl} =
Rephex.Util.call_optional(
{BehaviourAImpl, :foo, 2},
[1, 2],
{:ok, :but_not_impl}
)
end
end
Functions
@spec call_optional(mfa :: mfa(), args :: list(), default :: any()) :: any()
defmodule BehaviourA do
@callback foo(any(), any()) :: any()
@optional_callbacks foo: 2
end
defmodule BehaviourAImpl do
@behaviour BehaviourA
end
defmodule User do
def call_foo() do
{:ok, :but_not_impl} =
Rephex.Util.call_optional(
{BehaviourAImpl, :foo, 2},
[1, 2],
{:ok, :but_not_impl}
)
end
end