With elixir's __using__ macro and with the aid of __on_definition__ I can keep track of all methods in a module. What I would like to do is replace all methods in a module with some other implementation. Now it's fairly trivial to create the new methods I want but I also want to remove the existing methods.
Additionally to this, is there a way to apply a macro to several modules without explicitly adding the use XXX to each module. In otherwords if I have a folder structure:
- foo/
- bar/
- module1.ex
- module2.ex
- bar/
Could I dynamically apply the using macro to everything in ./foo/bar/.
To simplify my problem, imagine that for all methods in all modules in the foo/bar/ folder I want to change there implementation so that they will first run IO.inspect "called before method", aka some kind of before method aop.