Class: Quonfig::EvaluationDetails
- Inherits:
-
Object
- Object
- Quonfig::EvaluationDetails
- Defined in:
- lib/quonfig/evaluation_details.rb
Overview
Public details record returned by Quonfig::Client#get_*_details. Surfaces the resolution reason and (on error) an error_code/error_message alongside the resolved value, so downstream layers — most importantly the OpenFeature provider — can map the result without losing fidelity.
reason is one of the strings:
"STATIC" — config has no targeting rules; matched value is the static default
"TARGETING_MATCH" — a targeting rule matched (any non-ALWAYS_TRUE criterion)
"SPLIT" — matched value came from a weighted variant
"DEFAULT" — no rule matched (eval fell through)
"ERROR" — evaluation failed
error_code (only when reason == “ERROR”) is one of:
"FLAG_NOT_FOUND" — the key was unknown to the store
"TYPE_MISMATCH" — the resolved value didn't satisfy the requested type
"GENERAL" — any other failure
Constant Summary collapse
- REASON_STATIC =
'STATIC'- REASON_TARGETING_MATCH =
'TARGETING_MATCH'- REASON_SPLIT =
'SPLIT'- REASON_DEFAULT =
'DEFAULT'- REASON_ERROR =
'ERROR'- ERROR_FLAG_NOT_FOUND =
'FLAG_NOT_FOUND'- ERROR_TYPE_MISMATCH =
'TYPE_MISMATCH'- ERROR_GENERAL =
'GENERAL'
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(value:, reason:, error_code: nil, error_message: nil) ⇒ EvaluationDetails
constructor
A new instance of EvaluationDetails.
- #inspect ⇒ Object
Constructor Details
#initialize(value:, reason:, error_code: nil, error_message: nil) ⇒ EvaluationDetails
Returns a new instance of EvaluationDetails.
33 34 35 36 37 38 |
# File 'lib/quonfig/evaluation_details.rb', line 33 def initialize(value:, reason:, error_code: nil, error_message: nil) @value = value @reason = reason @error_code = error_code @error_message = end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
31 32 33 |
# File 'lib/quonfig/evaluation_details.rb', line 31 def error_code @error_code end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
31 32 33 |
# File 'lib/quonfig/evaluation_details.rb', line 31 def @error_message end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
31 32 33 |
# File 'lib/quonfig/evaluation_details.rb', line 31 def reason @reason end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
31 32 33 |
# File 'lib/quonfig/evaluation_details.rb', line 31 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
40 41 42 43 44 45 46 |
# File 'lib/quonfig/evaluation_details.rb', line 40 def ==(other) other.is_a?(EvaluationDetails) && other.value == @value && other.reason == @reason && other.error_code == @error_code && other. == @error_message end |
#hash ⇒ Object
49 50 51 |
# File 'lib/quonfig/evaluation_details.rb', line 49 def hash [@value, @reason, @error_code, @error_message].hash end |
#inspect ⇒ Object
53 54 55 56 57 58 |
# File 'lib/quonfig/evaluation_details.rb', line 53 def inspect parts = ["value=#{@value.inspect}", "reason=#{@reason.inspect}"] parts << "error_code=#{@error_code.inspect}" if @error_code parts << "error_message=#{@error_message.inspect}" if @error_message "#<Quonfig::EvaluationDetails #{parts.join(' ')}>" end |