Sha256: 4ea04f1876717496463d8a81202722ec59cf0fb5a6f51cf336f4c789ff07420f

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module OpenFeature
  # Used to combine evaluation contexts from different sources
  class EvaluationContextBuilder
    extend T::Sig

    sig do
      params(
        global_context: T.nilable(EvaluationContext),
        client_context: T.nilable(EvaluationContext),
        invocation_context: T.nilable(EvaluationContext)
      ).returns(T.nilable(EvaluationContext))
    end
    def call(global_context:, client_context:, invocation_context:)
      available_contexts = [global_context, client_context, invocation_context].compact

      return nil if available_contexts.empty?

      available_contexts.reduce(EvaluationContext.new) do |built_context, context|
        built_context.merge(context)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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