Packages
kino
0.9.3
0.19.0
0.18.0
0.17.0
0.16.1
0.16.0
0.15.3
0.15.2
0.15.1
0.15.0
0.14.2
0.14.1
0.14.0
0.13.2
0.13.1
0.13.0
0.12.3
0.12.2
0.12.1
0.12.0
0.11.3
0.11.2
0.11.1
0.11.0
0.10.0
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.0
0.6.2
0.6.1
0.6.0
retired
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.3
0.1.2
0.1.1
0.1.0
Interactive widgets for Livebook
Current section
Files
Jump to
Current section
Files
lib/kino/config.ex
defmodule Kino.Config do
@moduledoc false
@keys [:inspect]
@spec configuration() :: keyword()
def configuration() do
Application.get_all_env(:kino) |> Keyword.take(@keys)
end
@spec configuration(atom()) :: term()
def configuration(key, default \\ nil) when key in @keys do
Application.get_env(:kino, key, default)
end
@spec configure(keyword()) :: :ok
def configure(options) do
Enum.each(options, &validate_option/1)
configuration()
|> Keyword.merge(options, &merge_option/3)
|> update_configuration()
:ok
end
defp validate_option({:inspect, new}) when is_list(new), do: :ok
defp merge_option(:inspect, old, new) when is_list(new), do: Keyword.merge(old, new)
defp update_configuration(config) do
Enum.each(config, fn {key, value} when key in @keys ->
Application.put_env(:kino, key, value)
end)
end
end