Class: LaunchDarkly::EvaluationDetail
- Inherits:
-
Object
- Object
- LaunchDarkly::EvaluationDetail
- Defined in:
- lib/ldclient-rb/evaluation.rb
Overview
An object returned by ‘LDClient.variation_detail`, combining the result of a flag evaluation with an explanation of how it was calculated.
Instance Attribute Summary collapse
-
#reason ⇒ Hash
readonly
An object describing the main factor that influenced the flag evaluation value.
-
#value ⇒ Object
readonly
The result of the flag evaluation.
-
#variation_index ⇒ int|nil
readonly
The index of the returned value within the flag’s list of variations, e.g.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#default_value? ⇒ boolean
True if the flag evaluated to the default value rather than to one of its variations.
-
#initialize(value, variation_index, reason) ⇒ EvaluationDetail
constructor
A new instance of EvaluationDetail.
Constructor Details
#initialize(value, variation_index, reason) ⇒ EvaluationDetail
Returns a new instance of EvaluationDetail.
8 9 10 11 12 |
# File 'lib/ldclient-rb/evaluation.rb', line 8 def initialize(value, variation_index, reason) @value = value @variation_index = variation_index @reason = reason end |
Instance Attribute Details
#reason ⇒ Hash (readonly)
Returns An object describing the main factor that influenced the flag evaluation value.
23 24 25 |
# File 'lib/ldclient-rb/evaluation.rb', line 23 def reason @reason end |
#value ⇒ Object (readonly)
Returns The result of the flag evaluation. This will be either one of the flag’s variations or the default value that was passed to the ‘variation` method.
16 17 18 |
# File 'lib/ldclient-rb/evaluation.rb', line 16 def value @value end |
#variation_index ⇒ int|nil (readonly)
Returns The index of the returned value within the flag’s list of variations, e.g. 0 for the first variation - or ‘nil` if the default value was returned.
20 21 22 |
# File 'lib/ldclient-rb/evaluation.rb', line 20 def variation_index @variation_index end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 |
# File 'lib/ldclient-rb/evaluation.rb', line 31 def ==(other) @value == other.value && @variation_index == other.variation_index && @reason == other.reason end |
#default_value? ⇒ boolean
Returns True if the flag evaluated to the default value rather than to one of its variations.
27 28 29 |
# File 'lib/ldclient-rb/evaluation.rb', line 27 def default_value? variation_index.nil? end |