config: test for setting and getting bool
This commit is contained in:
@@ -36,6 +36,16 @@
|
||||
start_link(Handle) ->
|
||||
gen_server:start_link(?MODULE, Handle, []).
|
||||
|
||||
%% @doc Open a configuration file
|
||||
-spec open(iolist()) -> {ok, pid()} | {error, term()}.
|
||||
open(Path) ->
|
||||
case geef_nif:config_open(Path) of
|
||||
{ok, Handle} ->
|
||||
start_link(Handle);
|
||||
Error ->
|
||||
Error
|
||||
end.
|
||||
|
||||
%% @doc Set a value in the configuration
|
||||
set(Pid, Name, Val) when is_boolean(Val) ->
|
||||
gen_server:call(Pid, {set_bool, Name, Val}).
|
||||
|
||||
@@ -213,6 +213,10 @@ config_set_bool(_Handle, _Name, _Val) ->
|
||||
config_get_bool(_Handle, _Name) ->
|
||||
?NIF_FN.
|
||||
|
||||
-spec config_open(iolist()) -> {ok, term()} | {error, term()}.
|
||||
config_open(_Path) ->
|
||||
?NIF_FN.
|
||||
|
||||
nif_error(Line) ->
|
||||
erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user