Summary
Functions
Determines whether a given implementation_module is both a module and
implements the behaviour required by behaviour_module.
Functions
@spec behaviour_implemented?( implementation_module :: module(), behaviour_module :: module() ) :: :ok | {:error, :not_a_module, value :: term()} | {:error, :behaviour_not_implemented}
Determines whether a given implementation_module is both a module and
implements the behaviour required by behaviour_module.
Unfortunately, Elixir doesn't have an is_module guard, and you have to use
is_atom, as Modules are considered atoms.
iex> is_atom(SomeModule)
trueElixir will show you at compile-time (via a warning) if you haven't implemented a required function in a Behaviour. However, there is no way to determine whether or not a given Module implements another Module's Behaviour.
Return values
| Value | Meaning |
| :ok | module meets the criteria for the behaviour_module |
module is not actually a Module | |
module does not implement behaviour_module |