Class: Kameleoon::Targeting::ExclusiveExperiment Private

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

ExclusiveExperiment represents an instance of Exclusive Experiment condition in user account

Instance Attribute Summary

Attributes inherited from Condition

#include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ ExclusiveExperiment

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



13
14
15
16
17
18
19
20
# File 'lib/kameleoon/targeting/conditions/exclusive_experiment.rb', line 13

def initialize(json_condition)
  if json_condition['targetingType'].nil?
    raise Exception::NotFoundError.new('targetingType'), 'targetingType missed'
  end

  @type = json_condition['targetingType']
  @include = true
end

Instance Method Details

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



22
23
24
25
26
# File 'lib/kameleoon/targeting/conditions/exclusive_experiment.rb', line 22

def check(data)
  experiment_id = data.experiment_id
  storage = data.storage
  storage.nil? || storage.empty? || (storage.length == 1 && !storage[experiment_id].nil?)
end