Ejabberd.Config.Attr (ejabberd v21.4.0)

Module used to work with the attributes parsed from an elixir block (do...end).

Contains functions for extracting attrs from a block and validation.

Link to this section Summary

Functions

Takes a block with annotations and extracts the list of attributes.

Returns the default value for an attribute, given its name.

Returns the type of an attribute, given its name.

Takes an attribute or a list of attrs and validate them.

Link to this section Types

Specs

attr() :: {atom(), any()}

Link to this section Functions

Link to this function

extract_attrs_from_block_with_defaults(block)

Specs

extract_attrs_from_block_with_defaults(any()) :: [attr()]

Takes a block with annotations and extracts the list of attributes.

Link to this function

get_default_for_attr(attr_name)

Specs

get_default_for_attr(atom()) :: any()

Returns the default value for an attribute, given its name.

Link to this function

get_type_for_attr(attr_name)

Specs

get_type_for_attr(atom()) :: atom()

Returns the type of an attribute, given its name.

Link to this function

validate(attrs)

Specs

validate([attr()]) :: [{:ok, attr()}] | [{:error, attr(), atom()}]

Takes an attribute or a list of attrs and validate them.

Returns a {:ok, attr} or {:error, attr, cause} for each of the attributes.