Yml v0.9.1 Yml View Source
Module for reading/writing yml/yaml files
Link to this section Summary
Link to this section Functions
Link to this function
read_from_file(path_to_file)
View Source
read_from_file(String.t()) :: {:ok, %{}}
Read YML file to map
Parameters
- path_to_file: path to file for locale detection
Examples
iex> Yml.read_from_file("/path_to_file")
{:ok, %{}}
iex> Yml.read_from_file("/path_to_unexisted_file")
{:error, "File reading error"}
Write map to YML file
Parameters
- path_to_file: path to file for locale detection
- content: content represented as map
Examples
iex> Yml.write_to_file("/path_to_file", %{something => %{Hello: "Hello"}})
{:ok, "File is saved"}
Link to this function
write_to_string(content)
View Source
write_to_string(%{}) :: {:ok, String.t()}
Transform map to string before saving
Parameters
- content: content represented as map
Examples
iex> Yml.write_to_string(%{something => %{Hello: "Hello"}})
{:ok, ""}