1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

More idiomatic Elixir

This commit is contained in:
Daniel Barber 2018-02-28 10:12:26 -05:00
parent 3c50811d24
commit 059b45d40d
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

@ -38,12 +38,8 @@ defmodule Chess.Store.Game do
|> validate_required(required_attrs())
end
def change_turn(turn) do
case turn do
"white" -> "black"
"black" -> "white"
end
end
def change_turn("black"), do: "white"
def change_turn("white"), do: "black"
def for_user(user) do
from game in Game,