aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_util.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-09-12 16:29:53 -0500
committerEric <[email protected]>2012-09-12 16:29:53 -0500
commit75d48f5a2c01ed416b502192236cba1b9e57aeb8 (patch)
treed9b4a375920daa14cc7c611cee8fd13f4fcb555d /src/rcl_util.erl
parentdbd63739075a0f936f83a8dc9ae089e907a79c21 (diff)
downloadrelx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.tar.gz
relx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.tar.bz2
relx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.zip
add a to_binary to the utils
Diffstat (limited to 'src/rcl_util.erl')
-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
%%%===================================================================