diff options
author | Alex S <alex.strizhakov@gmail.com> | 2019-09-03 20:06:22 +0300 |
---|---|---|
committer | Alex S <alex.strizhakov@gmail.com> | 2019-09-11 09:25:33 +0300 |
commit | be32d90a0cdee77f4cd6ecbbbade1748c88637b8 (patch) | |
tree | e6353a4ac0729f8b69dc1f96c1f5d27db64e74fd | |
parent | 5ff12e7df10dd70f70e5929ede5dc7570e066c57 (diff) | |
download | pleroma-be32d90a0cdee77f4cd6ecbbbade1748c88637b8.tar.gz |
little refactor
-rw-r--r-- | lib/pleroma/docs/json.ex | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/pleroma/docs/json.ex b/lib/pleroma/docs/json.ex index aed730e78..18ba01d58 100644 --- a/lib/pleroma/docs/json.ex +++ b/lib/pleroma/docs/json.ex @@ -4,11 +4,13 @@ defmodule Pleroma.Docs.JSON do @spec process(keyword()) :: {:ok, String.t()} def process(descriptions) do config_path = "docs/generate_config.json" - {:ok, file} = File.open(config_path, [:write]) - json = generate_json(descriptions) - IO.write(file, json) - :ok = File.close(file) - {:ok, config_path} + + with {:ok, file} <- File.open(config_path, [:write]), + json <- generate_json(descriptions), + :ok <- IO.write(file, json), + :ok <- File.close(file) do + {:ok, config_path} + end end @spec generate_json([keyword()]) :: String.t() |