Created
February 25, 2017 22:16
-
-
Save vortec/190f6a7fe0c9fe4c4a661227c4aab19e to your computer and use it in GitHub Desktop.
This file contains 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
defmodule KVServer.Command do | |
@doc ~S""" | |
Parses a line into a command. | |
## Examples | |
iex> KVServer.Command.parse "CREATE shopping\r\n" | |
{:ok, {:create, "shopping"}} | |
""" | |
def parse(line) do | |
case String.split(line) do | |
["CREATE", bucket] -> {:ok, {:create, bucket}} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment