Class: OpenFeature::SDK::EvaluationContextBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/open_feature/sdk/evaluation_context_builder.rb

Overview

Used to combine evaluation contexts from different sources

Instance Method Summary collapse

Instance Method Details

#call(api_context:, client_context:, invocation_context:) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/open_feature/sdk/evaluation_context_builder.rb', line 5

def call(api_context:, client_context:, invocation_context:)
  available_contexts = [api_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