Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule MakeBehaviour do
- defmacro __using__(opts) do
- module = opts[:module]
- quote do
- if not is_nil(unquote(module)) do
- import unquote(module)
- end
- @on_definition {MakeBehaviour, :on_def}
- end
- end
- def on_def(%{module: module}, :def, name, args, _guards, _body) do
- Module.spec_to_callback(module, {name, length(args)})
- end
- def on_def(_, _, _, _, _, _), do: nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement