projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ff12e7
)
little refactor
author
Alex S
<alex.strizhakov@gmail.com>
Tue, 3 Sep 2019 17:06:22 +0000
(20:06 +0300)
committer
Alex S
<alex.strizhakov@gmail.com>
Wed, 11 Sep 2019 06:25:33 +0000
(09:25 +0300)
lib/pleroma/docs/json.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/docs/json.ex
b/lib/pleroma/docs/json.ex
index aed730e78fbbbf0bdf8e60e69452dcd34baf4bfd..18ba01d58aca56bb58b5edd38bdc738bb10d87c6 100644
(file)
--- 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"
@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()
end
@spec generate_json([keyword()]) :: String.t()