aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/rcl_util.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rcl_util.erl b/src/rcl_util.erl
index be20302..f6427ae 100644
--- a/src/rcl_util.erl
+++ b/src/rcl_util.erl
@@ -22,6 +22,7 @@
-module(rcl_util).
-export([mkdir_p/1,
+ to_binary/1,
indent/1]).
-define(ONE_LEVEL_INDENT, " ").
@@ -48,6 +49,13 @@ mkdir_p(Path) ->
indent(Amount) when erlang:is_integer(Amount) ->
[?ONE_LEVEL_INDENT || _ <- lists:seq(1, Amount)].
+-spec to_binary(iolist() | binary()) -> binary().
+to_binary(String) when erlang:is_list(String) ->
+ erlang:iolist_to_binary(String);
+to_binary(Bin) when erlang:is_binary(Bin) ->
+ Bin.
+
+
%%%===================================================================
%%% Test Functions
%%%===================================================================