diff --git a/README.md b/README.md index fb99ed20..2a54f4bf 100644 --- a/README.md +++ b/README.md @@ -152,12 +152,13 @@ For example, given the following broken code after an initial `mix format`: ```elixir defmodule MyGreatLibrary do @moduledoc make_pretty_docs(@library_options) + use OptionsMagic, my_opts: @library_options @library_options [ ... ] end ``` -You can fix the code by moving the static value outside of the module into a naked variable and then reference it in the module. +You can fix the code by moving the static value outside of the module into a naked variable and then reference it in the module. (Note that `use` macros need an `unquote` wrapping the variable!) Yes, this is a thing you can do in a `.ex` file =) @@ -166,6 +167,7 @@ library_options = [ ... ] defmodule MyGreatLibrary do @moduledoc make_pretty_docs(library_options) + use OptionsMagic, my_opts: unquote(library_options) @library_options library_options end