Here is an example of how you could achieve something similar:
https://gist.github.com/josevalim/7432084
I was going to add more information but I decided to provide a simple example and then answer any further question you may have. As a note though, try to make this rules DSL as simple as possible, if you see the macro code starting to get more and more complex, simply using a cond
(explicitly) would be better.