-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7104256
commit 751a466
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule Rewire.Macro do | ||
defmacro __using__(opts) do | ||
case opts do | ||
[use_alias: true] -> | ||
quote do | ||
alias Rewire.Hello | ||
alias Rewire.Macro | ||
end | ||
|
||
_ -> | ||
quote do | ||
import Rewire.Hello | ||
import Rewire.Macro | ||
end | ||
end | ||
end | ||
|
||
def good_afternoon do | ||
"good afternoon" | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Rewire.ModuleWithMacro do | ||
use Rewire.Macro | ||
|
||
def hello_passthrough do | ||
hello() | ||
end | ||
|
||
def good_afternoon_passthrough do | ||
good_afternoon() | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Rewire.ModuleWithMacroWithArgs do | ||
use Rewire.Macro, use_alias: true | ||
|
||
def hello_passthrough do | ||
Hello.hello() | ||
end | ||
|
||
def good_afternoon_passthrough do | ||
Macro.good_afternoon() | ||
end | ||
end |
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
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
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