Skip to content

Commit

Permalink
List behaviour callbacks in Edoc when using -callback attribute
Browse files Browse the repository at this point in the history
Defining a behaviour_info/1 function is no longer the only way to
define a behaviour; you can use -callback attributes as well.  This
change makes edoc aware of the latter, such that the module
documentation page for a behaviour module will list the name and arity
of the required callback functions.

Ideally, edoc should use the type information present in the callback
attributes, but with this change, the documentation is at least no
worse than when using an explicit behaviour_info function.
  • Loading branch information
legoscia authored and Richard Carlsson committed Jul 26, 2012
1 parent b06e8f2 commit b5a766d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/edoc_data.erl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ callbacks(Es, Module, Env, Opts) ->
case lists:any(fun (#entry{name = {behaviour_info, 1}}) -> true;
(_) -> false
end,
Es) of
Es)
orelse
lists:keymember(callback, 1, Module#module.attributes)
of
true ->
try (Module#module.name):behaviour_info(callbacks) of
Fs ->
Expand Down

0 comments on commit b5a766d

Please sign in to comment.