Skip to content

Commit

Permalink
incredibile...
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ruoss committed Jul 31, 2020
1 parent 82757bc commit a88e1d7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/ymlr/encoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ defmodule Ymlr.Encoder do
{key, nil} -> "#{key}:"
{key, value} when value == [] -> "#{key}: []"
{key, value} when value == %{} -> "#{key}: {}"
{key, value} when is_map(value) -> ["#{key}:" | [indentation | [" " | encode_as_io_list(value, level+1)]]]
{key, value} when is_list(value) -> ["#{key}:" | [indentation | [" " | encode_as_io_list(value, level+1)]]]
{key, value} -> ["#{key}: " | encode_as_io_list(value, level+1)]
{key, value} when is_map(value) -> ["#{key}:" | [indentation | [" " | encode_as_io_list(value, level + 1)]]]
{key, value} when is_list(value) -> ["#{key}:" | [indentation | [" " | encode_as_io_list(value, level + 1)]]]
{key, value} -> ["#{key}: " | encode_as_io_list(value, level + 1)]
end)
|> Enum.intersperse(indentation)
end
Expand All @@ -93,7 +93,7 @@ defmodule Ymlr.Encoder do
|> Enum.map(fn
nil -> "-"
"" -> ~s(- "")
value -> ["- " | encode_as_io_list(value, level+1)]
value -> ["- " | encode_as_io_list(value, level + 1)]
end)
|> Enum.intersperse(indentation)
end
Expand Down Expand Up @@ -162,5 +162,4 @@ defmodule Ymlr.Encoder do
["\n" | List.duplicate(" ", level)]
end


end

0 comments on commit a88e1d7

Please sign in to comment.