Class: Kameleoon::Targeting::TargetFeatureFlagCondition Private

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

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.

Defined Under Namespace

Classes: TargetingData

Constant Summary

Constants inherited from VisitorScopeCondition

VisitorScopeCondition::MAX_VISITOR_VISIT_COUNT, VisitorScopeCondition::MIN_VISITOR_VISIT_COUNT

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.



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

def initialize(json_condition)
  super(json_condition, VisitScope::CURRENT_VISIT)
  @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.



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

def check(data)
  return false unless valid_data?(data)

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