ExUtils v0.1.6 ExUtils

Collection of core Elixir utility methods that don’t fit in any specific Module

Summary

Functions

Checks if the term is a pure map (i.e. not a struct)

Checks if the term is a struct as well as a map

Functions

functions(module)

See ExUtils.Module.functions/1.

has_method?(module, method)

See ExUtils.Module.has_method?/2.

is_pure_map?(term)
is_pure_map?(term :: term) :: boolean

Checks if the term is a pure map (i.e. not a struct)

Example

ExUtils.is_pure_map?(%{a: 1, b: 2})          # => true
ExUtils.is_pure_map?(%Person{name: "Ali"})   # => false
is_struct?(term)
is_struct?(term :: term) :: boolean

Checks if the term is a struct as well as a map

Example

ExUnit.is_struct?(:atom)                  # => false
ExUnit.is_struct?(%{a: 1})                # => false
ExUnit.is_struct?(%Person{name: "Ali"})   # => true
methods(module)

See ExUtils.Module.methods/1.