Dogma v0.1.16 Dogma.RuleBuilder
The provider of the defrule/3
macro through which we define rules.
use Dogma.RuleBuilder
defrule MyRule, [some_option: 2] do
def test(rule, script) do
# check the script...
end
end
This expands into a module declaring a struct respresenting this rule and its options, as well as an implementation of the Dogma.Rule protocol for this struct.
The body of this macro must define the test/2
, which returns a list
of any errors found.
Dogma.Error
and Dogma.Script
are aliased to Error
and Script
inside the body of the macro.