Class: LaunchDarkly::OpenFeature::Provider
- Inherits:
-
Object
- Object
- LaunchDarkly::OpenFeature::Provider
- Defined in:
- lib/ldclient-openfeature/provider.rb
Instance Attribute Summary collapse
-
#client ⇒ LaunchDarkly::LDClient
readonly
Access the underlying LaunchDarky client instance backing this provider.
-
#metadata ⇒ ::OpenFeature::SDK::Provider::ProviderMetadata
readonly
Retrieve metadata information describing this provider.
Instance Method Summary collapse
- #fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
- #fetch_float_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
- #fetch_integer_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(sdk_key, config = LaunchDarkly::Config.default, wait_for_seconds = 5) ⇒ Provider
constructor
A new instance of Provider.
Constructor Details
#initialize(sdk_key, config = LaunchDarkly::Config.default, wait_for_seconds = 5) ⇒ Provider
Returns a new instance of Provider.
33 34 35 36 37 38 39 40 |
# File 'lib/ldclient-openfeature/provider.rb', line 33 def initialize(sdk_key, config = LaunchDarkly::Config.default, wait_for_seconds = 5) @client = LaunchDarkly::LDClient.new(sdk_key, config, wait_for_seconds) @context_converter = Impl::EvaluationContextConverter.new(config.logger) @details_converter = Impl::ResolutionDetailsConverter.new @metadata = ::OpenFeature::SDK::Provider::ProviderMetadata.new(name: "launchdarkly-openfeature-server").freeze end |
Instance Attribute Details
#client ⇒ LaunchDarkly::LDClient (readonly)
Access the underlying LaunchDarky client instance backing this provider.
This is useful for accessing additional functionality not exposed by the provider.
23 24 25 |
# File 'lib/ldclient-openfeature/provider.rb', line 23 def client @client end |
#metadata ⇒ ::OpenFeature::SDK::Provider::ProviderMetadata (readonly)
Retrieve metadata information describing this provider.
14 15 16 |
# File 'lib/ldclient-openfeature/provider.rb', line 14 def @metadata end |
Instance Method Details
#fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
42 43 44 |
# File 'lib/ldclient-openfeature/provider.rb', line 42 def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:boolean, flag_key, default_value, evaluation_context) end |
#fetch_float_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
58 59 60 |
# File 'lib/ldclient-openfeature/provider.rb', line 58 def fetch_float_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:float, flag_key, default_value, evaluation_context) end |
#fetch_integer_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
54 55 56 |
# File 'lib/ldclient-openfeature/provider.rb', line 54 def fetch_integer_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:integer, flag_key, default_value, evaluation_context) end |
#fetch_number_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
50 51 52 |
# File 'lib/ldclient-openfeature/provider.rb', line 50 def fetch_number_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:number, flag_key, default_value, evaluation_context) end |
#fetch_object_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
62 63 64 |
# File 'lib/ldclient-openfeature/provider.rb', line 62 def fetch_object_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:object, flag_key, default_value, evaluation_context) end |
#fetch_string_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
46 47 48 |
# File 'lib/ldclient-openfeature/provider.rb', line 46 def fetch_string_value(flag_key:, default_value:, evaluation_context: nil) resolve_value(:string, flag_key, default_value, evaluation_context) end |