Created
March 9, 2019 00:05
-
-
Save aharpole/f0ca58a8a5b89d9e87e185ba81a81eca to your computer and use it in GitHub Desktop.
new start_link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def start_link(opts) do | |
{state_opts, opts} = Keyword.split(opts, [:increment_by]) | |
state_opts = Keyword.merge([increment_by: 1], state_opts) #default to incrementing by 1 still | |
GenServer.start_link(__MODULE__, state_opts, opts) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment