populator v0.5.0 Populator.Helpers

require Populator.Helpers, as: H # the cool way

Summary

Functions

Gets names for children in given supervisor. Children with no registered name are not returned. List is sorted. Options al passed to children_data/2

Apply given defaults to given Keyword. Returns merged Keyword

Convenience to get environment bits. Avoid all that repetitive Application.get_env( :myapp, :blah, :blah) noise

Get linked pids list, useful to guess supervisor children without blocking it

Kill all of given supervisor’s children

Raise an error if any given key is not in the given Keyword. Returns given Keyword, so it can be chained using pipes

Start a children with given spec in the given supervisor if not already started

Wait for given function to return true. Optional msecs and step. Be aware that exceptions raised and thrown messages by given func will be discarded. Optional :timeout giving the return value for a timeout event. Special :raise value (default) will raise en exception

Macros

Spit to stdout any passed variable, with location information

Print to stdout a TODO message, with location information

Functions

children_names(supervisor)

Gets names for children in given supervisor. Children with no registered name are not returned. List is sorted. Options al passed to children_data/2.

defaults(args, defs)

Apply given defaults to given Keyword. Returns merged Keyword.

env(key, default \\ nil)

Convenience to get environment bits. Avoid all that repetitive Application.get_env( :myapp, :blah, :blah) noise.

env(app, key, default)
get_linked_ids(name)

Get linked pids list, useful to guess supervisor children without blocking it.

kill_children(supervisor)

Kill all of given supervisor’s children

requires(args, required)

Raise an error if any given key is not in the given Keyword. Returns given Keyword, so it can be chained using pipes.

start_child(spec, supervisor)

Start a children with given spec in the given supervisor if not already started.

Returns {:ok, child} if the child is successfully started or it was already started. {:error, reason} otherwise.

wait_for(opts \\ [], func)

Wait for given function to return true. Optional msecs and step. Be aware that exceptions raised and thrown messages by given func will be discarded. Optional :timeout giving the return value for a timeout event. Special :raise value (default) will raise en exception.

Macros

spit(obj \\ "", inspect_opts \\ [])

Spit to stdout any passed variable, with location information.

todo(msg \\ "")

Print to stdout a TODO message, with location information.