Module: OpenFeatureSorbet

Extended by:
T::Sig
Defined in:
lib/open_feature_sorbet.rb,
lib/open_feature_sorbet/hook.rb,
lib/open_feature_sorbet/hooks.rb,
lib/open_feature_sorbet/client.rb,
lib/open_feature_sorbet/provider.rb,
lib/open_feature_sorbet/structure.rb,
lib/open_feature_sorbet/error_code.rb,
lib/open_feature_sorbet/hook_context.rb,
lib/open_feature_sorbet/configuration.rb,
lib/open_feature_sorbet/flag_metadata.rb,
lib/open_feature_sorbet/no_op_provider.rb,
lib/open_feature_sorbet/client_metadata.rb,
lib/open_feature_sorbet/provider_status.rb,
lib/open_feature_sorbet/provider_metadata.rb,
lib/open_feature_sorbet/evaluation_context.rb,
lib/open_feature_sorbet/evaluation_details.rb,
lib/open_feature_sorbet/evaluation_options.rb,
lib/open_feature_sorbet/resolution_details.rb,
lib/open_feature_sorbet/multiple_source_provider.rb,
lib/open_feature_sorbet/evaluation_context_builder.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Modules: Hook Classes: Client, ClientMetadata, Configuration, ErrorCode, EvaluationContext, EvaluationContextBuilder, EvaluationDetails, EvaluationOptions, HookContext, Hooks, MultipleSourceProvider, NoOpProvider, Provider, ProviderMetadata, ProviderStatus, ResolutionDetails

Constant Summary collapse

Structure =
T.type_alias { T.any(T::Array[T.untyped], T::Hash[T.untyped, T.untyped]) }
FlagMetadata =
T.type_alias { T::Hash[String, T.any(T::Boolean, String, Numeric)] }

Class Method Summary collapse

Class Method Details

.add_hooks(hooks) ⇒ Object



33
34
35
# File 'lib/open_feature_sorbet.rb', line 33

def add_hooks(hooks)
  configuration.hooks.concat(Array(hooks))
end

.configurationObject



59
60
61
# File 'lib/open_feature_sorbet.rb', line 59

def configuration
  Configuration.instance
end

.create_client(name: nil, evaluation_context: nil, hooks: nil) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/open_feature_sorbet.rb', line 44

def create_client(name: nil, evaluation_context: nil, hooks: nil)
  Client.new(
    provider: configuration.provider,
    name: name,
    evaluation_context: evaluation_context,
    hooks: Array(hooks)
  )
end

.provider_metadataObject



16
17
18
# File 'lib/open_feature_sorbet.rb', line 16

def 
  configuration.
end

.set_evaluation_context(context) ⇒ Object

rubocop:disable Naming/AccessorMethodName



28
29
30
# File 'lib/open_feature_sorbet.rb', line 28

def set_evaluation_context(context) # rubocop:disable Naming/AccessorMethodName
  configuration.evaluation_context = context
end

.set_provider(provider) ⇒ Object

rubocop:disable Naming/AccessorMethodName



21
22
23
24
25
# File 'lib/open_feature_sorbet.rb', line 21

def set_provider(provider) # rubocop:disable Naming/AccessorMethodName
  configuration.provider.shutdown
  provider.init(context: configuration.evaluation_context || EvaluationContext.new)
  configuration.provider = provider
end

.shutdownObject



54
55
56
# File 'lib/open_feature_sorbet.rb', line 54

def shutdown
  configuration.provider.shutdown
end