Added custom rules factory config parameter to allow returning custom
instances of rules during code generation.