Current section

Files

Jump to
mark_yamill lib mark_yamill.ex
Raw

lib/mark_yamill.ex

defmodule MarkYamill do
alias MarkYamill.Decoder
def decode(encoded) do
encoded
|> parse()
|> Decoder.decode()
end
def decode_file(path) do
File.read!(path) |> decode
end
defp parse("---") do
nil
end
defp parse(encoded) do
case :yamerl_constr.string(encoded) do
list when length(list) > 1 -> list
list -> List.first(list)
end
end
end