Toolshed.Misc (toolshed v0.2.22) View Source

Miscellaneous helpers

Link to this section Summary

Functions

Exit the current IEx session

Load an Erlang term from the filesystem.

Save an Erlang term to the filesystem for easy loading later

Save a value to a file as Elixir terms

Link to this section Functions

Exit the current IEx session

Load an Erlang term from the filesystem.

Examples

#

iex> save_term!({:some_interesting_atom, ["some", "list"]}, "/root/some_atom.term")
{:some_interesting_atom, ["some", "list"]}
iex> load_term!("/root/some_atom.term")
{:some_interesting_atom, ["some", "list"]}

Specs

save_term!(term(), Path.t()) :: term()

Save an Erlang term to the filesystem for easy loading later

This function returns the value passed in to allow easy piping.

Examples

#

iex> :sys.get_state(MyServer) |> save_term!("/root/my_server.term")
# Reboot board
iex> :sys.replace_state(&load_term!("/root/my_server.term"))
Link to this function

save_value(value, path, inspect_opts \\ [])

View Source

Save a value to a file as Elixir terms

Examples

# Save the contents of SystemRegistry to a file
iex> SystemRegistry.match(:_) |> save_value("/root/sr.txt")
:ok