I’ve put @on_definition {Hooks, :rule_ids} in module Rules but in the other module called Hooks I cannot see how I can accumulate the ids and make use of them in the rule_ids/6 function.
defmodule Hooks do
Module.register_attribute(__MODULE__, :rule_ids, accumulate: true, persist: false)
def rule_ids(_env, :def, :condition, [rule_id | _], _guards, _body)
when is_integer(rule_id)
do
IO.puts rule_id
end
def rule_ids(_env, _kind, _name, _args, _guards, _body), do: nil
end


















