The only supported versions in the list of children are module()
, {module, arg}
or :supervisor.child_spec()
. There’s no tuple-3 option at all. I blogged about that system in more detail yesterday: Child Specs in Elixir
So you need to send everything in one arg
to be sent to child_spec/1
. You could do something like this:
defmodule MySupervisor do
def child_spec(init_arg) do
{children, opts} = extract_from_init_arg(init_arg)
%{
id: __MODULE__
start: {Supervisor, :start_link, [children, opts]}
type: :supervisor
}
end
end
Which would allow for {MySupervisor, some_children_and_opts_format}
. If that’s actually cleaner than a private function building the child_spec manually I’m not so sure about, given that the list of children is unlikely just some small argument to place in the tuple format.