Class: Featureflip::Evaluation::Evaluator
- Inherits:
-
Object
- Object
- Featureflip::Evaluation::Evaluator
- Defined in:
- lib/featureflip/evaluation/evaluator.rb
Constant Summary collapse
- MAX_PREREQUISITE_DEPTH =
Mirrors packages/js-sdk/src/core/evaluator.ts. The guard uses ‘>` (not `>=`) so a chain of MAX_PREREQUISITE_DEPTH + 1 nested flags trips the cap — matches the JS reference implementation; see prerequisite_spec.rb depth test.
10
Instance Method Summary collapse
- #evaluate(flag, context, get_segment: nil, all_flags: {}) ⇒ Object
- #evaluate_with_shared_memo(flag, context, all_flags:, memo:, get_segment: nil) ⇒ Object
-
#initialize ⇒ Evaluator
constructor
A new instance of Evaluator.
Constructor Details
#initialize ⇒ Evaluator
Returns a new instance of Evaluator.
12 13 14 |
# File 'lib/featureflip/evaluation/evaluator.rb', line 12 def initialize @condition_evaluator = ConditionEvaluator.new end |
Instance Method Details
#evaluate(flag, context, get_segment: nil, all_flags: {}) ⇒ Object
16 17 18 |
# File 'lib/featureflip/evaluation/evaluator.rb', line 16 def evaluate(flag, context, get_segment: nil, all_flags: {}) evaluate_with_shared_memo(flag, context, get_segment: get_segment, all_flags: all_flags, memo: {}) end |
#evaluate_with_shared_memo(flag, context, all_flags:, memo:, get_segment: nil) ⇒ Object
20 21 22 |
# File 'lib/featureflip/evaluation/evaluator.rb', line 20 def evaluate_with_shared_memo(flag, context, all_flags:, memo:, get_segment: nil) evaluate_internal(flag, context, get_segment, all_flags, 0, memo) end |