...
The ruleset evaluation engine essentially selects the variation in which the first rule is satisfied. It can be defined recursively in 4 lines. Note that the following below is just pseudo-code aimed to illustrate the core logic that is used for steps taken during flag evaluation.
Code Block |
---|
evaluate(ruleset, fallthrough_variation) :: (Ruleset, Variation) -> Variation if (ruleset is empty) return fallthrough_variation cons {condition, identity, segement, variation} = ruleset.pop() if (<condition> matches <identity | segment>) then return variation return evaluate(ruleset, fallthrough_variation) |
...