Class: OpenFeature::GoFeatureFlag::Provider
- Inherits:
-
Object
- Object
- OpenFeature::GoFeatureFlag::Provider
- Defined in:
- lib/openfeature/go-feature-flag/go_feature_flag_provider.rb
Overview
This class is the entry point for the GoFeatureFlagProvider
Constant Summary collapse
- PROVIDER_NAME =
"GO Feature Flag Provider"
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
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(options: Options.new) ⇒ Provider
constructor
A new instance of Provider.
Constructor Details
#initialize(options: Options.new) ⇒ Provider
Returns a new instance of Provider.
10 11 12 13 14 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 10 def initialize(options: Options.new) @metadata = SDK::Provider::ProviderMetadata.new(name: PROVIDER_NAME) @options = @goff_api = GoFeatureFlagApi.new(options: ) end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 8 def @metadata end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 8 def @options end |
Instance Method Details
#fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
16 17 18 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 16 def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil) evaluate(flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, allowed_classes: [TrueClass, FalseClass]) end |
#fetch_number_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
24 25 26 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 24 def fetch_number_value(flag_key:, default_value:, evaluation_context: nil) evaluate(flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, allowed_classes: [Integer, Float]) end |
#fetch_object_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
28 29 30 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 28 def fetch_object_value(flag_key:, default_value:, evaluation_context: nil) evaluate(flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, allowed_classes: [Array, Hash]) end |
#fetch_string_value(flag_key:, default_value:, evaluation_context: nil) ⇒ Object
20 21 22 |
# File 'lib/openfeature/go-feature-flag/go_feature_flag_provider.rb', line 20 def fetch_string_value(flag_key:, default_value:, evaluation_context: nil) evaluate(flag_key: flag_key, default_value: default_value, evaluation_context: evaluation_context, allowed_classes: [String]) end |