Aurora.Uix.BehaviourHelper (Aurora UIX v0.1.4-rc.0)

Copy Markdown

Validates that modules implement specified behaviours and all their callbacks.

Summary

Functions

Checks if a module implements a given behaviour.

Validates that a module implements a given behaviour.

Functions

behaviour_implemented?(module, behaviour)

@spec behaviour_implemented?(module(), module()) :: boolean()

Checks if a module implements a given behaviour.

Parameters

  • module (module()) - The module to check.
  • behaviour (module()) - The behaviour module to check against.

Returns

boolean() - true if the module implements the behaviour, false otherwise.

validate(module, behaviour)

@spec validate(module(), module()) :: module()

Validates that a module implements a given behaviour.

Checks if the module implements the behaviour and all its callbacks. If the validation fails, it raises an ArgumentError.

Parameters

  • module (module()) - The module to validate.
  • behaviour (module()) - The behaviour module to check against.

Returns

module() - The validated module if it implements the behaviour.

Raises

ArgumentError - If the module does not implement the behaviour or is missing callbacks.