Class: Datadog::OpenFeature::NativeEvaluator
- Inherits:
-
Object
- Object
- Datadog::OpenFeature::NativeEvaluator
- Defined in:
- lib/datadog/open_feature/native_evaluator.rb
Overview
This class is an interface of evaluation logic using native extension
Constant Summary collapse
- INVALID_FLAG_CONFIGURATION_ERROR_MESSAGE =
"flag configuration is invalid or unsupported"
Instance Attribute Summary collapse
-
#observe_full_evaluation_data ⇒ Object
readonly
Returns the value of attribute observe_full_evaluation_data.
Instance Method Summary collapse
-
#get_assignment(flag_key, default_value:, expected_type:, context:) ⇒ ResolutionDetails
Returns the assignment for a given flag key based on the feature flags configuration.
-
#initialize(configuration) ⇒ NativeEvaluator
constructor
NOTE: In a currect implementation configuration is expected to be a raw JSON string containing feature flags (straight from the remote config) in the format expected by
libdatadogwithout any modifications.
Constructor Details
#initialize(configuration) ⇒ NativeEvaluator
NOTE: In a currect implementation configuration is expected to be a raw
JSON string containing feature flags (straight from the remote config)
in the format expected by libdatadog without any modifications
17 18 19 20 |
# File 'lib/datadog/open_feature/native_evaluator.rb', line 17 def initialize(configuration) @configuration = Core::FeatureFlags::Configuration.new(configuration) @observe_full_evaluation_data = parse_observe_full_evaluation_data(configuration) end |
Instance Attribute Details
#observe_full_evaluation_data ⇒ Object (readonly)
Returns the value of attribute observe_full_evaluation_data.
22 23 24 |
# File 'lib/datadog/open_feature/native_evaluator.rb', line 22 def observe_full_evaluation_data @observe_full_evaluation_data end |
Instance Method Details
#get_assignment(flag_key, default_value:, expected_type:, context:) ⇒ ResolutionDetails
Returns the assignment for a given flag key based on the feature flags configuration
35 36 37 38 39 40 41 |
# File 'lib/datadog/open_feature/native_evaluator.rb', line 35 def get_assignment(flag_key, default_value:, expected_type:, context:) result = @configuration.get_assignment(flag_key, expected_type, context) return invalid_flag_configuration_error(default_value) if invalid_flag_configuration?(result) build_resolution_details(result, default_value) end |