From 669d2558d4bb0a4f75cb7196ef36c2e5ea119691 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 3 Dec 2024 09:38:12 +0000 Subject: [PATCH] No need to expose LastFm.Config.new/1 --- lib/last_fm/config.ex | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/last_fm/config.ex b/lib/last_fm/config.ex index 8be32dff..df1949c7 100644 --- a/lib/last_fm/config.ex +++ b/lib/last_fm/config.ex @@ -11,19 +11,17 @@ defmodule LastFm.Config do user: "", refresh_interval: 60_000 - @spec new(Enumerable.t()) :: t() - def new(opts) do - struct(__MODULE__, opts) - end - @spec enabled?(t) :: boolean() def enabled?(config) do config.api && config.user !== "" && config.api_key !== "" end + @spec resolve(atom) :: t def resolve(otp_app) do - otp_app - |> Application.get_env(LastFm) - |> new() + app_config = + otp_app + |> Application.get_env(LastFm) + + struct(__MODULE__, app_config) end end