Packages

A Mix formatter plugin that column-aligns Elixir code

Retired package: Deprecated - Renamed to exalign

Current section

Files

Jump to
ex_align dev test fixtures expected nested_case.ex
Raw

dev/test/fixtures/expected/nested_case.ex

defmodule Example.NestedCase do
def handle(conn, params) do
case conn.method do
"GET" ->
case Map.get(params, "id") do
nil -> {:error, :missing_id}
id -> {:ok, id}
end
"POST" ->
case Map.get(params, "body") do
nil -> {:error, :missing_body}
body -> {:ok, body}
end
_ ->
{:error, :unsupported_method}
end
end
def classify_triple({a, b, c}) do
case {a, b, c} do
{nil, nil, nil} -> :all_nil
{x, nil, nil} when is_integer(x) -> {:one, x}
{x, y, nil} when is_integer(x) and is_integer(y) -> {:two, x, y}
{x, y, z} when is_integer(x) and is_integer(y) and is_integer(z) -> {:three, x, y, z}
_ -> :mixed
end
end
end