Skip to content

Commit

Permalink
Merge 04b91a6 into 9313ed2
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinst committed Sep 21, 2018
2 parents 9313ed2 + 04b91a6 commit 772e4f4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/pub_sub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ defmodule PubSub do
@doc """
Starts the server.
"""
def start_link() do
@spec start_link() :: GenServer.on_start()
@spec start_link(list) :: GenServer.on_start()
def start_link(_args \\ []) do
GenServer.start_link(__MODULE__, :ok, [{:name, __MODULE__}])
end

Expand Down Expand Up @@ -93,6 +95,13 @@ defmodule PubSub do
GenServer.call(__MODULE__, {:topics})
end

@spec child_spec(list) :: map
def child_spec(arg) do
%{
id: __MODULE__,
start: {__MODULE__, :start_link, [arg]}
}
end

## Callbacks

Expand Down Expand Up @@ -161,5 +170,4 @@ defmodule PubSub do
defp find_process(pid) when is_atom(pid) do
Process.whereis(pid)
end

end

0 comments on commit 772e4f4

Please sign in to comment.