this repo has no description
at master 20 lines 476 B view raw
1defmodule Hobbes.Construct.SimSupervisor do 2 # TODO: move this module out of Construct 3 use GenServer 4 alias Trinity.SimServer 5 6 def start_link(children, opts) do 7 SimServer.start_link(__MODULE__, {children, opts}) 8 end 9 10 def init({children, _opts}) do 11 # TODO: trap exits? 12 Enum.map(children, &spawn_child/1) 13 {:ok, nil} 14 end 15 16 defp spawn_child({module, arg} = _child_spec) do 17 %{start: {m, f, a}} = module.child_spec(arg) 18 apply(m, f, a) 19 end 20end