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
Instance Method Summary collapse
-
#get_assignment(flag_key, default_value:, expected_type:, context:) ⇒ Core::FeatureFlags::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 ‘libdatadog` without 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
12 13 14 |
# File 'lib/datadog/open_feature/native_evaluator.rb', line 12 def initialize(configuration) @configuration = Core::FeatureFlags::Configuration.new(configuration) end |
Instance Method Details
#get_assignment(flag_key, default_value:, expected_type:, context:) ⇒ Core::FeatureFlags::ResolutionDetails
Returns the assignment for a given flag key based on the feature flags configuration
27 28 29 30 31 32 33 34 35 |
# File 'lib/datadog/open_feature/native_evaluator.rb', line 27 def get_assignment(flag_key, default_value:, expected_type:, context:) result = @configuration.get_assignment(flag_key, expected_type, context) # NOTE: This is a special case when we need to fallback to the default # value, even tho the evaluation itself doesn't produce an error # resolution details result.value = default_value if result.variant.nil? result end |