diff options
author | Eric <[email protected]> | 2012-09-12 16:29:53 -0500 |
---|---|---|
committer | Eric <[email protected]> | 2012-09-12 16:29:53 -0500 |
commit | 75d48f5a2c01ed416b502192236cba1b9e57aeb8 (patch) | |
tree | d9b4a375920daa14cc7c611cee8fd13f4fcb555d | |
parent | dbd63739075a0f936f83a8dc9ae089e907a79c21 (diff) | |
download | relx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.tar.gz relx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.tar.bz2 relx-75d48f5a2c01ed416b502192236cba1b9e57aeb8.zip |
add a to_binary to the utils
-rw-r--r-- | src/rcl_util.erl | 8 |
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 %%%=================================================================== |