Skip to content

Commit

Permalink
Change from ensure_loaded/1 to ensure_compiled/1 (#359)
Browse files Browse the repository at this point in the history
Co-authored-by: José Valim <[email protected]>
  • Loading branch information
TeoDiaz and josevalim authored Mar 14, 2023
1 parent da71fb6 commit d596823
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/gettext/plural.ex
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ defmodule Gettext.Plural do

@doc false
def plural_info(locale, messages_struct, plural_mod) do
ensure_loaded!(plural_mod)
ensure_compiled!(plural_mod)

if function_exported?(plural_mod, :init, 1) do
pluralization_context =
Expand All @@ -385,7 +385,7 @@ defmodule Gettext.Plural do

@doc false
def plural_forms_header_impl(locale, messages_struct, plural_mod) do
ensure_loaded!(plural_mod)
ensure_compiled!(plural_mod)

plural_forms_header =
if function_exported?(plural_mod, :plural_forms_header, 1) do
Expand All @@ -401,11 +401,11 @@ defmodule Gettext.Plural do
end

# TODO: remove when we depend on Elixir 1.12+
if function_exported?(Code, :ensure_loaded!, 1) do
defp ensure_loaded!(mod), do: Code.ensure_loaded!(mod)
if function_exported?(Code, :ensure_compiled!, 1) do
defp ensure_compiled!(mod), do: Code.ensure_compiled!(mod)
else
defp ensure_loaded!(mod) do
case Code.ensure_loaded(mod) do
defp ensure_compiled!(mod) do
case Code.ensure_compiled(mod) do
{:module, ^mod} ->
mod

Expand Down

0 comments on commit d596823

Please sign in to comment.