View Source Wobserver.Util.Helper (Wobserver NG v1.14.0)

Helper functions and JSON encoders.

Link to this section Summary

Functions

Formats function information as readable string.

Parallel map implemented with Task.

Converts Strings to module names or atoms.

Link to this section Functions

@spec format_function(nil | {atom(), atom(), integer()} | atom()) :: String.t() | nil

Formats function information as readable string.

Only name will be return if only name is given.

Example:

iex> format_function {Logger, :log, 2}
"Logger.log/2"
iex> format_function :format_function
"format_function"
iex> format_function nil
nil
Link to this function

parallel_map(enum, function)

View Source
@spec parallel_map(enum :: list(), function :: (... -> any())) :: list()

Parallel map implemented with Task.

Maps the function over the enum using Task.async/1 and Task.await/1.

Link to this function

string_to_module(module)

View Source
@spec string_to_module(module :: String.t()) :: atom()

Converts Strings to module names or atoms.

The given module string will be turned into atoms that get concatted.