Class: Feat::EvalContext

Inherits:
Struct
  • Object
show all
Defined in:
lib/feat/context.rb

Overview

SDK-consumer-supplied context. Mirrors OpenFeature’s pattern: a ‘targeting_key` shorthand for “user.key”, and a `kinds` hash whose keys match the datafile’s ‘contextKinds` map.

Example:

Feat::EvalContext.new(
  targeting_key: "user-123",
  kinds: {
    "user"         => { "key" => "user-123", "email" => "u@example.com" },
    "organization" => { "key" => "acme",     "plan"  => "pro" }
  }
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(targeting_key: nil, kinds: {}) ⇒ EvalContext

Returns a new instance of EvalContext.



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

def initialize(targeting_key: nil, kinds: {})
  super
end

Instance Attribute Details

#kindsObject

Returns the value of attribute kinds

Returns:

  • (Object)

    the current value of kinds



15
16
17
# File 'lib/feat/context.rb', line 15

def kinds
  @kinds
end

#targeting_keyObject

Returns the value of attribute targeting_key

Returns:

  • (Object)

    the current value of targeting_key



15
16
17
# File 'lib/feat/context.rb', line 15

def targeting_key
  @targeting_key
end