Class: LaunchDarkly::Impl::Model::EvalResultsForSingleVariation

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/model/preprocessed_data.rb

Overview

Container for a precomputed result that includes a specific variation index and value, an evaluation reason, and optionally an alternate evaluation reason that corresponds to the “in experiment” state.

Since:

  • 5.5.0

Instance Method Summary collapse

Constructor Details

#initialize(value, variation_index, regular_reason, in_experiment_reason = nil) ⇒ EvalResultsForSingleVariation

Returns a new instance of EvalResultsForSingleVariation.

Since:

  • 5.5.0



12
13
14
15
16
17
# File 'lib/ldclient-rb/impl/model/preprocessed_data.rb', line 12

def initialize(value, variation_index, regular_reason, in_experiment_reason = nil)
  @regular_result = EvaluationDetail.new(value, variation_index, regular_reason)
  @in_experiment_result = in_experiment_reason ?
    EvaluationDetail.new(value, variation_index, in_experiment_reason) :
    @regular_result
end

Instance Method Details

#get_result(in_experiment = false) ⇒ LaunchDarkly::EvaluationDetail

Parameters:

  • in_experiment (Boolean) (defaults to: false)

    indicates whether we want the result to include “inExperiment: true” in the reason or not

Returns:

Since:

  • 5.5.0



22
23
24
# File 'lib/ldclient-rb/impl/model/preprocessed_data.rb', line 22

def get_result(in_experiment = false)
  in_experiment ? @in_experiment_result : @regular_result
end