Class: Confidence::OpenFeature::Provider
- Inherits:
-
Object
- Object
- Confidence::OpenFeature::Provider
- Defined in:
- lib/confidence/openfeature/provider.rb
Overview
See NoOpProvider in the OpenFeature Ruby SDK for the interface
Defined Under Namespace
Classes: ResolutionDetails
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
- #fetch_number_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
- #fetch_object_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
- #fetch_string_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
-
#initialize(api_client:, apply_on_resolve: true) ⇒ Provider
constructor
A new instance of Provider.
Constructor Details
#initialize(api_client:, apply_on_resolve: true) ⇒ Provider
Returns a new instance of Provider.
18 19 20 21 22 |
# File 'lib/confidence/openfeature/provider.rb', line 18 def initialize(api_client:, apply_on_resolve: true) @api_client = api_client @apply_on_resolve = apply_on_resolve @metadata = ::OpenFeature::SDK::Provider::ProviderMetadata.new(name: "Confidence").freeze end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/confidence/openfeature/provider.rb', line 10 def @metadata end |
Instance Method Details
#fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/confidence/openfeature/provider.rb', line 24 def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) evaluate( flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, validator: lambda { |v| v === true || v === false } ) end |
#fetch_number_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/confidence/openfeature/provider.rb', line 42 def fetch_number_value(flag_key:, default_value:, evaluation_context: nil) evaluate( flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, validator: lambda { |v| v.is_a?(Numeric) } ) end |
#fetch_object_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/confidence/openfeature/provider.rb', line 51 def fetch_object_value(flag_key:, default_value:, evaluation_context: nil) evaluate( flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context ) end |
#fetch_string_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/confidence/openfeature/provider.rb', line 33 def fetch_string_value(flag_key:, default_value:, evaluation_context: nil) evaluate( flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, validator: lambda { |v| v.is_a?(String) } ) end |