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

#id, #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(device) ⇒ 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
# File 'lib/kameleoon/targeting/conditions/device_condition.rb', line 15

def check(device)
  device.is_a?(Kameleoon::Device) && @device_type == device.device_type
end