View Source ebus_common (ebus v0.3.0)

Common utilities.

Link to this section Summary

Functions

Build a name given the list of terms, then they are transformed to binary and concatenated by Separator.
Searches into the list of tuples TupleList for a tuple whose Nth element compares equal to Key. Returns Tuple's value if such a tuple is found, otherwise Default.
Returns a random element from given list L.
Converts any type to atom.
Converts any type to binary.
Converts any type to float.
Converts any type to integer.
Converts any type to list.

Link to this section Functions

Equivalent to build_name(L, <<"_">>).

Link to this function

build_name(L, Separator)

View Source
-spec build_name([any()], iodata()) -> atom().
Build a name given the list of terms, then they are transformed to binary and concatenated by Separator.

Equivalent to keyfind(Key, TupleList, nil).

Link to this function

keyfind(Key, TupleList, Default)

View Source
-spec keyfind(term(), [tuple()], term()) -> term().
Searches into the list of tuples TupleList for a tuple whose Nth element compares equal to Key. Returns Tuple's value if such a tuple is found, otherwise Default.
-spec rand_elem([term()]) -> term().
Returns a random element from given list L.
-spec to_atom(any()) -> atom().
Converts any type to atom.
-spec to_bin(any()) -> binary().
Converts any type to binary.
-spec to_float(any()) -> float().
Converts any type to float.
-spec to_int(any()) -> integer().
Converts any type to integer.
-spec to_list(any()) -> list().
Converts any type to list.

Equivalent to wait_until(Fun, 50).

Link to this function

wait_until(Fun, Retries)

View Source

Equivalent to wait_until(Fun, Retries, 100).

Link to this function

wait_until(Fun, Retries, Timeout)

View Source
-spec wait_until(fun(), non_neg_integer(), timeout()) -> term().