Skip to content

Commit

Permalink
Ensure __info__/1 is available
Browse files Browse the repository at this point in the history
Erlang modules do not have this function
  • Loading branch information
edgurgel committed Jun 22, 2024
1 parent 7dc8745 commit ea12b00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mimic/module.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ defmodule Mimic.Module do
end

defp generate_mimic_struct(module) do
if module.__info__(:struct) != nil do
if function_exported?(module, :__info__, 1) && module.__info__(:struct) != nil do
required_fields = for %{field: field, required: true} <- module.__info__(:struct), do: field

quote do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Mimic.Mixfile do
use Mix.Project

@source_url "https://github.com/edgurgel/mimic"
@version "1.8.0"
@version "1.8.1"

def project do
[
Expand Down

0 comments on commit ea12b00

Please sign in to comment.