Class: Kameleoon::Targeting::BrowserCondition Private

Inherits:
Condition
  • Object
show all
Defined in:
lib/kameleoon/targeting/conditions/browser_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.

BrowserCondition is a condition for checking targeting with browser’s type and version

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ BrowserCondition

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



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

def initialize(json_condition)
  super(json_condition)
  @browser_type = browser_index_from_name(json_condition['browser'])
  @version = json_condition['version']
  @version_match_type = json_condition['versionMatchType']
end

Instance Method Details

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



25
26
27
# File 'lib/kameleoon/targeting/conditions/browser_condition.rb', line 25

def check(browser)
  browser.is_a?(Kameleoon::Browser) && check_targeting(browser)
end