From 6a82ead205f4463ee34cc4fcbc06f1b3e7b1dd1a Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 5 Mar 2018 13:51:14 +0100 Subject: Starting to work on the client diff messages. --- src/struct/direction.erl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/struct/direction.erl') diff --git a/src/struct/direction.erl b/src/struct/direction.erl index 074cadf..84ae272 100644 --- a/src/struct/direction.erl +++ b/src/struct/direction.erl @@ -12,8 +12,8 @@ -export ( [ - from_binary/1, - to_binary/1 + decode/1, + encode/1 ] ). @@ -24,13 +24,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec from_binary (binary()) -> enum(). -from_binary (<<"U">>) -> up; -from_binary (<<"D">>) -> down; -from_binary (<<"L">>) -> left; -from_binary (<<"R">>) -> right. +-spec decode (binary()) -> enum(). +decode (<<"U">>) -> up; +decode (<<"D">>) -> down; +decode (<<"L">>) -> left; +decode (<<"R">>) -> right. -to_binary (up) -> <<"U">>; -to_binary (down) -> <<"D">>; -to_binary (left) -> <<"L">>; -to_binary (right) -> <<"R">>. +-spec encode (enum()) -> binary(). +encode (up) -> <<"U">>; +encode (down) -> <<"D">>; +encode (left) -> <<"L">>; +encode (right) -> <<"R">>. -- cgit v1.2.3-70-g09d2