Skip to content

Instantly share code, notes, and snippets.

@os6sense
Created February 13, 2015 13:46
Show Gist options
  • Save os6sense/db80d6970db6091f9089 to your computer and use it in GitHub Desktop.
Save os6sense/db80d6970db6091f9089 to your computer and use it in GitHub Desktop.
__using__ using use
# used from within a test (e.g. use UseDI.A) the following is output:
# __using__ UseDI. caller : Elixir.UseDependencyInjectionTest
# __using__ UseDI.A. caller : Elixir.UseDependencyInjectionTest
import IO, only: [puts: 1]
defmodule UseDI do
defmacro __using__(_) do
quote do
puts " __using__ UseDI. caller : #{unquote(__CALLER__.module)}"
end
end
end
defmodule UseDI.A do
defmacro __using__(_) do
quote do
use UseDI
puts " __using__ UseDI.A. caller : #{unquote(__CALLER__.module)}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment