Class: Kameleoon::Targeting::PageUrlCondition Private

Inherits:
StringValueCondition show all
Defined in:
lib/kameleoon/targeting/conditions/page_url_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.

PageUrlCondition is a condition for checking url of a page

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ PageUrlCondition

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 PageUrlCondition.



12
13
14
# File 'lib/kameleoon/targeting/conditions/page_url_condition.rb', line 12

def initialize(json_condition)
  super(json_condition, json_condition['url'])
end

Instance Method Details

#check(page_view_visit_storage) ⇒ 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.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kameleoon/targeting/conditions/page_url_condition.rb', line 16

def check(page_view_visit_storage)
  return false unless page_view_visit_storage.is_a?(Kameleoon::DataManager::DataMapStorage)
  return !page_view_visit_storage.get(condition_value).nil? if operator == Operator::EXACT

  is_targeted = false
  page_view_visit_storage.enumerate do |visit|
    is_targeted = check_page_view_visit(visit)
    break if is_targeted
  end
  is_targeted
end