Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ftrvxmtrx committed Jul 8, 2012
1 parent 50b1887 commit cc33501
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/emark_utils.erl
@@ -1,3 +1,5 @@
%% @doc Misc utils.

-module(emark_utils).

-export([ ceil/1
Expand All @@ -8,6 +10,7 @@

-include("emark_internal.hrl").

%% @doc Round a number to a greater one, looking a lot nicer.
ceil(X) ->
Floor = floor_10(X),

Expand All @@ -22,9 +25,11 @@ ceil(X) ->
10 * Floor
end.

%% @doc Exports without those with "_benchmark" suffix.
exports_of_forms(Forms) ->
exports_of_forms(Forms, no_autoexport).

%% @doc Exports, including those with "_benchmark" suffix.
exports_of_forms(Forms, Suffix) ->
F = fun({ attribute, _, export, ExList }, Accu) ->
sets:union(sets:from_list(ExList), Accu);
Expand All @@ -44,8 +49,10 @@ exports_of_forms(Forms, Suffix) ->

lists:foldl(F, sets:new(), Forms).

%% @doc Round a number to a lower one.
floor_10(X) ->
trunc(math:pow(10, trunc(math:log10(X)))).

%% @doc Get function suffix ("_benchmark") from emark options.
fun_suffix(Options) ->
proplists:get_value(emark_fun_suffix, Options, ?DEFAULT_FUN_SUFFIX).

0 comments on commit cc33501

Please sign in to comment.