Class: Hackle::TargetingType

Inherits:
Object
  • Object
show all
Defined in:
lib/hackle/internal/model/targeting.rb

Constant Summary collapse

IDENTIFIER =
new(
  [
    TargetKeyType::SEGMENT
  ]
)
PROPERTY =
new(
  [
    TargetKeyType::SEGMENT,
    TargetKeyType::USER_PROPERTY,
    TargetKeyType::HACKLE_PROPERTY,
    TargetKeyType::AB_TEST,
    TargetKeyType::FEATURE_FLAG
  ]
)
SEGMENT =
new(
  [
    TargetKeyType::USER_ID,
    TargetKeyType::USER_PROPERTY,
    TargetKeyType::HACKLE_PROPERTY
  ]
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(supported_key_types) ⇒ TargetingType

Returns a new instance of TargetingType.

Parameters:



13
14
15
16
# File 'lib/hackle/internal/model/targeting.rb', line 13

def initialize(supported_key_types)
  # @type [Array<TargetKeyType>]
  @supported_key_types = supported_key_types
end

Instance Attribute Details

#supported_key_typesObject (readonly)

Returns the value of attribute supported_key_types.



10
11
12
# File 'lib/hackle/internal/model/targeting.rb', line 10

def supported_key_types
  @supported_key_types
end

Instance Method Details

#supports?(key_type) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


19
20
21
# File 'lib/hackle/internal/model/targeting.rb', line 19

def supports?(key_type)
  @supported_key_types.include?(key_type)
end