Created
November 3, 2014 16:45
-
-
Save rossjones/c157c6d52d1da098eb16 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 Ddd.Macros do | |
defmacro __using__ do | |
@rules [] | |
end | |
defmacro defrule(signature, body) do | |
quote do | |
# Prepend the signature to the list of rules.... | |
@rules [ signature | @rules] | |
def unquote(signature) do | |
unquote(body[:do]) | |
end | |
end | |
end | |
end | |
defmodule Ddd.Actions do | |
use Ddd.Macros | |
defrule something(items) do | |
.... | |
end | |
end |
chrismccord
commented
Nov 3, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment