Class: OpenFeatureSorbet::EvaluationDetails

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Generic, T::Sig
Includes:
T::Struct::ActsAsComparable
Defined in:
lib/open_feature_sorbet/evaluation_details.rb

Overview

Information about resolved value, created by a Provider.

Constant Summary collapse

Value =
type_member
SelfValue =
type_template

Class Method Summary collapse

Class Method Details

.from_error(error_message, flag_key:, default_value:) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/open_feature_sorbet/evaluation_details.rb', line 45

def from_error(error_message, flag_key:, default_value:)
  EvaluationDetails.new(
    flag_key: flag_key,
    value: default_value,
    error_code: ErrorCode::General,
    error_message: "Provider raised error: #{error_message}",
    reason: "ERROR"
  )
end

.from_resolution_details(details, flag_key:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/open_feature_sorbet/evaluation_details.rb', line 26

def from_resolution_details(details, flag_key:)
  EvaluationDetails.new(
    flag_key: flag_key,
    value: details.value,
    error_code: details.error_code,
    error_message: details.error_message,
    variant: details.variant,
    reason: details.reason,
    flag_metadata: details.
  )
end