Class: Kameleoon::Targeting::PageTitleCondition Private

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

PageTitleCondition is a condition for checking title of a page

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ PageTitleCondition

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



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

def initialize(json_condition)
  super(json_condition, json_condition['title'])
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
# File 'lib/kameleoon/targeting/conditions/page_title_condition.rb', line 16

def check(page_view_visit_storage)
  return false unless page_view_visit_storage.is_a?(Kameleoon::DataManager::DataMapStorage)

  is_targeted = false
  page_view_visit_storage.enumerate do |visit|
    is_targeted = visit.is_a?(Kameleoon::DataManager::PageViewVisit) && check_targeting(visit.page_view.title)
    break if is_targeted
  end
  is_targeted
end