Class: Kameleoon::Targeting::PageTitleCondition Private
- Inherits:
-
StringValueCondition
- Object
- Condition
- StringValueCondition
- Kameleoon::Targeting::PageTitleCondition
- 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
Instance Method Summary collapse
- #check(page_view_visits) ⇒ Object private
-
#initialize(json_condition) ⇒ PageTitleCondition
constructor
private
A new instance of PageTitleCondition.
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_visits) ⇒ 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 27 |
# File 'lib/kameleoon/targeting/conditions/page_title_condition.rb', line 16 def check(page_view_visits) return false unless page_view_visits.is_a?(Kameleoon::DataManager::DataMapStorage) latest = nil page_view_visits.enumerate do |visit| if visit.is_a?(Kameleoon::DataManager::PageViewVisit) \ && (latest.nil? || visit. > latest.) latest = visit end end !latest.nil? && latest.is_a?(Kameleoon::DataManager::PageViewVisit) && check_targeting(latest.page_view.title) end |