ExUtils v0.1.6 ExUtils.Module

Generic Elixir utility methods for modules themselves

Summary

Functions

Checks if a Module exports a specific method

Returns a Keyword List of all methods of a module

Returns a String of the Module’s name (without the Elixir namespace)

Functions

functions(module)

See ExUtils.Module.methods/1.

has_method?(module, method)
has_method?(module :: module, method :: atom | {atom, number}) :: boolean

Checks if a Module exports a specific method

First argument must be a Module and the second argument can either be an :atom name of the function or a {:atom, arity} tuple.

Can also be directly accessed as ExUtils.has_method?/2.

Example

ExUtils.has_method?(Map, :keys)         # => true
ExUtils.has_method?(Map, {:keys, 1})    # => true
ExUtils.has_method?(Map, {:keys, 2})    # => false
methods(module)
methods(module :: module) :: Keyword.t

Returns a Keyword List of all methods of a module

Calling methods on Module will return a {:atom, arity} Keyword List of all the functions of that module.

You can also use these other aliases of this method:

Example

ExUtils.functions(List)
# => [delete: 2, delete_at: 2, duplicate: 2, flatten: 1, flatten: 2, ...]
name(module)
name(module :: module) :: String.t

Returns a String of the Module’s name (without the Elixir namespace)

Example

ExUtils.Module.name(SomeModule)       # => "SomeModule"
ExUtils.Module.name(Another.Module)   # => "Another.Module"