StringToElixir Reads Elixir data structure from file (for example Keyword List) as string and converts to Elixir data**
If available in Hex, the package can be installed as:
- Add
string_to_elixir
to your list of dependencies inmix.exs
:
def deps do
[{:elixir_to_string, "~> 0.1.1"}]
end
- Example of usage
qwe.txt
content
[
my_config: [
key_value: "BA"
]
]
First parameter is a file name, second Module name, third function name
StringToElixir("/home/zaali/qwe.txt", MyNewUndefinedModule, func_name)
MyNewUndefinedModule.func_name == [my_config: [key_value: "BA"]]