ymlr - A YAML Encoder for Elixir
ymlr - A YAML encoder for Elixir.
Installation
The package can be installed by adding ymlr to your list of dependencies in mix.exs:
def deps do
[
{:ymlr, "~> 1.0"}
]
endExamples
Encode a single document - optionally with comments:
iex> Ymlr.document!(%{a: 1})
"""
---
a: 1
"""
iex> Ymlr.document!({"comment", %{a: 1}})
"""
---
# comment
a: 1
"""
iex> Ymlr.document!({["comment 1", "comment 2"], %{"a" => "a", "b" => :b, "c" => "true", "d" => "100"}})
"""
---
# comment 1
# comment 2
a: a
b: b
c: 'true'
d: '100'
"""Encode a multiple documents
iex> Ymlr.documents!([%{a: 1}, %{b: 2}])
"""
---
a: 1
---
b: 2
"""A Word on Stability
This library is still in beta and should not be used in production. While it encodes most of the given data correctly, there might still be some edge cases we haven't come across yet. Please help us find and fix those, preferably by creating a pull request.