Class: Kameleoon::Targeting::TargetFeatureFlagCondition Private

Inherits:
Condition
  • Object
show all
Includes:
Exception
Defined in:
lib/kameleoon/targeting/conditions/target_feature_flag_condition.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

TargetFeatureFlag represents an instance of FeatureFlag condition in user account

API:

  • private

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ TargetFeatureFlagCondition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TargetFeatureFlagCondition.

API:

  • private



13
14
15
16
17
18
19
# File 'lib/kameleoon/targeting/conditions/target_feature_flag_condition.rb', line 13

def initialize(json_condition)
  super(json_condition)

  @feature_flag_id = json_condition['featureFlagId']
  @condition_variation_key = json_condition['variationKey']
  @condition_rule_id = json_condition['ruleId']
end

Instance Method Details

#check(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



21
22
23
24
25
# File 'lib/kameleoon/targeting/conditions/target_feature_flag_condition.rb', line 21

def check(data)
  return false unless data.is_a?(TargetFeatureFlagInfo) && data.variations_storage.size.positive?

  get_rules(data).any? { |rule| check_rule(data, rule) }
end