We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf4023b commit d233074Copy full SHA for d233074
1 file changed
lib/atomic_map.ex
@@ -1,13 +1,12 @@
1
defmodule AtomicMap do
2
- def convert(v, opts \\ [])
3
+ def convert(v, opts \\ [])
4
def convert(struct=%{__struct__: type}, opts) do
5
struct
6
|> Map.from_struct
7
|> convert(opts)
8
|> Map.put(:__struct__, type)
9
end
10
-
11
def convert(map, opts) when is_map(map) do
12
safe = Keyword.get(opts, :safe, true)
13
map |> Enum.reduce(%{}, fn({k,v}, acc)->
@@ -23,9 +22,8 @@ defmodule AtomicMap do
23
22
tuple |> Tuple.to_list |> convert(opts) |> List.to_tuple
24
25
def convert(v, _opts), do: v
26
- defp as_atom(s, true) when is_binary(s), do: s |> String.to_existing_atom
27
- defp as_atom(s, true), do: s
28
+ defp as_atom(s, true) when is_binary(s), do: s |> String.to_existing_atom
29
defp as_atom(s, false) when is_binary(s), do: s |> String.to_atom
30
- defp as_atom(s, false), do: s
+ defp as_atom(s, _), do: s
31
0 commit comments