Class: OpenFeatureSorbet::NoOpProvider
- Extended by:
- T::Sig
- Defined in:
- lib/open_feature_sorbet/no_op_provider.rb
Overview
Default provider when initializing OpenFeature. Always returns the default value given. This will result in a TypeError if the given default value does not have the correct type.
Instance Attribute Summary collapse
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Attributes inherited from Provider
Instance Method Summary collapse
-
#initialize ⇒ NoOpProvider
constructor
A new instance of NoOpProvider.
- #resolve_boolean_value(flag_key:, default_value:, context: nil) ⇒ Object
- #resolve_number_value(flag_key:, default_value:, context: nil) ⇒ Object
- #resolve_string_value(flag_key:, default_value:, context: nil) ⇒ Object
- #resolve_structure_value(flag_key:, default_value:, context: nil) ⇒ Object
Methods inherited from Provider
Constructor Details
#initialize ⇒ NoOpProvider
Returns a new instance of NoOpProvider.
18 19 20 21 22 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 18 def initialize @metadata = T.let(ProviderMetadata.new(name: "No Op Provider"), ProviderMetadata) @hooks = T.let([], T::Array[Hook]) super() end |
Instance Attribute Details
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
15 16 17 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 15 def hooks @hooks end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
12 13 14 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 12 def @metadata end |
Instance Method Details
#resolve_boolean_value(flag_key:, default_value:, context: nil) ⇒ Object
33 34 35 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 33 def resolve_boolean_value(flag_key:, default_value:, context: nil) ResolutionDetails.new(value: default_value, reason: "DEFAULT") end |
#resolve_number_value(flag_key:, default_value:, context: nil) ⇒ Object
59 60 61 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 59 def resolve_number_value(flag_key:, default_value:, context: nil) ResolutionDetails.new(value: default_value, reason: "DEFAULT") end |
#resolve_string_value(flag_key:, default_value:, context: nil) ⇒ Object
46 47 48 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 46 def resolve_string_value(flag_key:, default_value:, context: nil) ResolutionDetails.new(value: default_value, reason: "DEFAULT") end |
#resolve_structure_value(flag_key:, default_value:, context: nil) ⇒ Object
72 73 74 |
# File 'lib/open_feature_sorbet/no_op_provider.rb', line 72 def resolve_structure_value(flag_key:, default_value:, context: nil) ResolutionDetails.new(value: default_value, reason: "DEFAULT") end |