Sha256: af9564eec53dc22feaaacdec1c168bc5bca43d28fd59d888af6e21bcc1ad9a45

Contents?: true

Size: 1009 Bytes

Versions: 7

Compression:

Stored size: 1009 Bytes

Contents

# typed: strict
# frozen_string_literal: true

require "singleton"

module OpenFeature
  # Singleton class that supports global configuration for OpenFeature.
  # Should not be interacted with directly; rather, favor interacting
  # with methods defined on the `OpenFeature` module.
  class Configuration
    extend T::Sig

    include Singleton

    sig { returns(Provider) }
    attr_accessor :provider

    sig { returns(T.nilable(EvaluationContext)) }
    attr_accessor :evaluation_context

    sig { returns(T::Array[Hook]) }
    attr_accessor :hooks

    sig { void }
    def initialize
      @provider = T.let(NoOpProvider.new, Provider)
      @evaluation_context = T.let(nil, T.nilable(EvaluationContext))
      @hooks = T.let([], T::Array[Hook])
    end

    sig { returns(ProviderMetadata) }
    def provider_metadata
      provider.metadata
    end

    sig { void }
    def reset!
      @provider = OpenFeature::NoOpProvider.new
      @hooks = []
      @evaluation_context = nil
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openfeature-sdk-sorbet-0.4.0 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.3.1 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.3.0 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.2.0.2 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.2.1 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.2.0.1 lib/open_feature/configuration.rb
openfeature-sdk-sorbet-0.2.0 lib/open_feature/configuration.rb