Rules as list #24
-
Is it possible to create a list containing rule definition, then use matches method that return rules that matches the object ? |
Beta Was this translation helpful? Give feedback.
Answered by
zeroSteiner
Aug 20, 2021
Replies: 1 comment 2 replies
-
If you have one rule and many objects, you'd want to use the |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
zeroSteiner
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have one rule and many objects, you'd want to use the
Rule.filter
method. If you have many rules and one object, you'd need to initialize aRule
object for each and apply them to your object like:[rule_text for rule_text in all_rule_texts if Rule(rule_text).matches(object)]
.