Class: LaunchDarkly::Impl::Model::EvalResultFactoryMultiVariations
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::Model::EvalResultFactoryMultiVariations
- Defined in:
- lib/ldclient-rb/impl/model/preprocessed_data.rb
Overview
Container for a set of precomputed results, one for each possible flag variation.
Instance Method Summary collapse
- #for_variation(index, in_experiment) ⇒ LaunchDarkly::EvaluationDetail
-
#initialize(variation_factories) ⇒ EvalResultFactoryMultiVariations
constructor
A new instance of EvalResultFactoryMultiVariations.
Constructor Details
#initialize(variation_factories) ⇒ EvalResultFactoryMultiVariations
Returns a new instance of EvalResultFactoryMultiVariations.
31 32 33 |
# File 'lib/ldclient-rb/impl/model/preprocessed_data.rb', line 31 def initialize(variation_factories) @factories = variation_factories end |
Instance Method Details
#for_variation(index, in_experiment) ⇒ LaunchDarkly::EvaluationDetail
39 40 41 42 43 44 45 |
# File 'lib/ldclient-rb/impl/model/preprocessed_data.rb', line 39 def for_variation(index, in_experiment) if index < 0 || index >= @factories.length EvaluationDetail.new(nil, nil, EvaluationReason.error(EvaluationReason::ERROR_MALFORMED_FLAG)) else @factories[index].get_result(in_experiment) end end |