Class: AmplitudeExperiment::Evaluation::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/experiment/evaluation/evaluation.rb

Overview

Engine for evaluating feature flags based on context

Instance Method Summary collapse

Instance Method Details

#evaluate(context, flags) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/experiment/evaluation/evaluation.rb', line 7

def evaluate(context, flags)
  results = {}
  target = {
    'context' => context,
    'result' => results
  }

  flags.each do |flag|
    variant = evaluate_flag(target, flag)
    results[flag.key] = variant if variant
  end

  results
end