From 6712eaa5c8196dc1ba179257d050b131959c2a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 18 Apr 2011 12:20:52 +0200 Subject: Rename match() into match_rule(). --- include/types.hrl | 4 ++-- src/cowboy_dispatcher.erl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/types.hrl b/include/types.hrl index 8bb94fb..5ee9357 100644 --- a/include/types.hrl +++ b/include/types.hrl @@ -20,8 +20,8 @@ -type bindings() :: list({Key::atom(), Value::string()}). -type path_tokens() :: list(nonempty_string()). --type match() :: '_' | '*' | list(string() | '_' | atom()). +-type match_rule() :: '_' | '*' | list(string() | '_' | atom()). --type dispatch_rule() :: {Host::match(), list({Path::match(), +-type dispatch_rule() :: {Host::match_rule(), list({Path::match_rule(), Handler::module(), Opts::term()})}. -type dispatch_rules() :: list(dispatch_rule()). diff --git a/src/cowboy_dispatcher.erl b/src/cowboy_dispatcher.erl index 366aab8..46cf717 100644 --- a/src/cowboy_dispatcher.erl +++ b/src/cowboy_dispatcher.erl @@ -55,7 +55,7 @@ match(Host, Path, [{HostMatch, PathMatchs}|Tail]) -> match_path(Path, PathMatchs, HostBinds) end. --spec match_path(Path::path_tokens(), list({Path::match(), +-spec match_path(Path::path_tokens(), list({Path::match_rule(), Handler::module(), Opts::term()}), HostBinds::bindings()) -> {ok, Handler::module(), Opts::term(), Binds::bindings()} | {error, notfound, path}. @@ -75,7 +75,7 @@ match_path(Path, [{PathMatch, Handler, Opts}|Tail], HostBinds) -> %% Internal. --spec try_match(Type::host | path, List::path_tokens(), Match::match()) +-spec try_match(Type::host | path, List::path_tokens(), Match::match_rule()) -> {true, Binds::bindings()} | false. try_match(_Type, _List, '_') -> {true, []}; @@ -86,7 +86,7 @@ try_match(host, List, Match) -> try_match(path, List, Match) -> list_match(List, Match, []). --spec list_match(List::path_tokens(), Match::match(), Binds::bindings()) +-spec list_match(List::path_tokens(), Match::match_rule(), Binds::bindings()) -> {true, Binds::bindings()} | false. %% Atom '_' matches anything, continue. list_match([_E|Tail], ['_'|TailMatch], Binds) -> -- cgit v1.2.3