Class: Kameleoon::Targeting::DeviceCondition Private

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

DeviceCondition is a condition for checking device type

Instance Attribute Summary

Attributes inherited from Condition

#include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ DeviceCondition

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



10
11
12
13
# File 'lib/kameleoon/targeting/conditions/device_condition.rb', line 10

def initialize(json_condition)
  super(json_condition)
  @device_type = json_condition['device']
end

Instance Method Details

#check(list_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.



15
16
17
18
# File 'lib/kameleoon/targeting/conditions/device_condition.rb', line 15

def check(list_data)
  device = get_last_targeting_data(list_data, Kameleoon::DataType::DEVICE)
  device && @device_type == device.device_type
end