Behave v0.1.0 Behave View Source
Behave
allows you to check whether one Elixir module implements a
given
Behaviour.
Link to this section Summary
Functions
Determines whether a given implementation_module
is both a module and
implements the behaviour required by behaviour_module
.
Link to this section Functions
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)
true
Elixir 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 |
{:error, :not_a_module, module} | module is not actually a Module |
{:error, :behaviour_not_implemented} | module does not implement behaviour_module |