Skip to content

Commit

Permalink
Merge pull request #1 from SkipMike/SkipMike-patch-1
Browse files Browse the repository at this point in the history
Make struct check more robust
  • Loading branch information
SkipMike authored Oct 5, 2018
2 parents 0d93ac9 + 92ac9c3 commit 5fd57dc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/maptu.ex
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,9 @@ defmodule Maptu do
end

defp ensure_struct(mod) when is_atom(mod) do
if function_exported?(mod, :__struct__, 0) do
:ok
else
{:error, {:non_struct, mod}}
case mod.module_info(:functions)[:struct] do
0 -> :ok
nil -> {:error, {:non_struct, mod}}
end
end

Expand Down

0 comments on commit 5fd57dc

Please sign in to comment.