Last active
August 29, 2015 14:03
-
-
Save trestrantham/1e7ac76f301ec6d3ec77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Test do | |
Module.register_attribute __MODULE__, :config, accumulate: true, persist: false | |
@before_compile __MODULE__ | |
defmacro __before_compile__(_) do | |
quote do | |
Module.put_attribute(__MODULE__, :config, { :foo, "foo" }) | |
end | |
end | |
def env, do: @config | |
end | |
# == Compilation error on file lib/test.ex == | |
# ** (UndefinedFunctionError) undefined function: Test.__before_compile__/1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment