defmodule Hobbes.Construct.SimSupervisor do # TODO: move this module out of Construct use GenServer alias Trinity.SimServer def start_link(children, opts) do SimServer.start_link(__MODULE__, {children, opts}) end def init({children, _opts}) do # TODO: trap exits? Enum.map(children, &spawn_child/1) {:ok, nil} end defp spawn_child({module, arg} = _child_spec) do %{start: {m, f, a}} = module.child_spec(arg) apply(m, f, a) end end