Class: OpenFeatureSorbet::NoOpProvider

Inherits:
Provider
  • Object
show all
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

Attributes inherited from Provider

#status

Instance Method Summary collapse

Methods inherited from Provider

#init, #shutdown

Constructor Details

#initializeNoOpProvider

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

#hooksObject (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

#metadataObject (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