Skip to content

Commit 5127828

Browse files
committed
Do preserve the legacy API, but log a warning
1 parent f9036f7 commit 5127828

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

lib/fun_with_flags.ex

+50-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,56 @@ defmodule FunWithFlags do
77
See the [Usage](/fun_with_flags/readme.html#usage).
88
"""
99

10-
use FunWithFlags.EntryPoint
10+
defmodule PrivateEntryPoint do
11+
@moduledoc false
12+
use FunWithFlags.EntryPoint
1113

12-
@impl true
13-
def config do
14-
{:ok, []}
14+
@impl true
15+
def config do
16+
{:ok, []}
17+
end
18+
end
19+
20+
require Logger
21+
@deprecation_msg "Using the FunWithFlags module directly is deprecated. (TODO link to docs)"
22+
23+
def enabled?(flag_name, options \\ []) do
24+
Logger.warning(@deprecation_msg)
25+
PrivateEntryPoint.enabled?(flag_name, options)
26+
end
27+
28+
def enable(flag_name, options \\ []) do
29+
Logger.warning(@deprecation_msg)
30+
PrivateEntryPoint.enable(flag_name, options)
31+
end
32+
33+
def disable(flag_name, options \\ []) do
34+
Logger.warning(@deprecation_msg)
35+
PrivateEntryPoint.disable(flag_name, options)
36+
end
37+
38+
def clear(flag_name, options \\ []) do
39+
Logger.warning(@deprecation_msg)
40+
PrivateEntryPoint.clear(flag_name, options)
41+
end
42+
43+
def all_flag_names() do
44+
Logger.warning(@deprecation_msg)
45+
PrivateEntryPoint.all_flag_names()
46+
end
47+
48+
def all_flags() do
49+
Logger.warning(@deprecation_msg)
50+
PrivateEntryPoint.all_flags()
51+
end
52+
53+
def get_flag(flag_name) do
54+
Logger.warning(@deprecation_msg)
55+
PrivateEntryPoint.get_flag(flag_name)
56+
end
57+
58+
def compiled_store() do
59+
Logger.warning(@deprecation_msg)
60+
PrivateEntryPoint.compiled_store()
1561
end
1662
end

0 commit comments

Comments
 (0)