Generic Elixir utility methods for modules themselves
Summary
Functions
Check if a module exists and is compiled
Returns a Keyword List of all functions of a module.
Checks if a Module exports a specific function.
has_method?(module, function)
deprecated
methods(module)
deprecated
Returns a String of the Module's name (without the Elixir namespace)
Functions
Check if a module exists and is compiled
Example
iex> ExUtils.Modules.exists?(Map)
true
iex> ExUtils.Modules.exists?(NonExistentModule)
false
Returns a Keyword List of all functions of a module.
Calling this will return a {:atom, arity} keyword list
of all the functions of that module.
Example
iex> {:flatten, 1} in ExUtils.Modules.functions(List)
true
iex> {:unknown, 2} in ExUtils.Modules.functions(List)
false
@spec has_function?(module(), atom() | {atom(), non_neg_integer()}) :: boolean()
Checks if a Module exports a specific function.
First argument must be a Module and the second argument can
either be an :atom name of the function or a {:atom, arity}
tuple.
Example
iex> ExUtils.Modules.has_function?(Map, :keys)
true
iex> ExUtils.Modules.has_function?(Map, {:keys, 1})
true
iex> ExUtils.Modules.has_function?(Map, {:keys, 2})
false
This function is deprecated. Use ExUtils.Modules.has_function?/2 instead.
This function is deprecated. Use ExUtils.Modules.functions/1 instead.
Returns a String of the Module's name (without the Elixir namespace)
Example
iex> ExUtils.Modules.name(SomeModule)
"SomeModule"
iex> ExUtils.Modules.name(Another.Module)
"Another.Module"