name: __MODULE__) end def add_task(task) when is_binary(task) do GenServer.cast(__MODULE__, {:add, task}) end def list_tasks, do: GenServer.call(__MODULE__, :list) # Private def handle_cast({:add, task}, tasks), do: {:noreply, [task | tasks]} def handle_call(:list, _from, tasks), do: {:reply, tasks, tasks} end