Class: Kameleoon::Hybrid::ManagerImpl
- Defined in:
- lib/kameleoon/hybrid/manager.rb
Overview
Implementation of Cache with auto cleaning feature
Instance Method Summary collapse
- #get_engine_tracking_code(visitor_variations) ⇒ Object
-
#initialize(expiration_time, log_func) ⇒ ManagerImpl
constructor
A new instance of ManagerImpl.
Constructor Details
#initialize(expiration_time, log_func) ⇒ ManagerImpl
Returns a new instance of ManagerImpl.
20 21 22 23 24 25 |
# File 'lib/kameleoon/hybrid/manager.rb', line 20 def initialize(expiration_time, log_func) super() @expiration_time = expiration_time @log = log_func @log.call('Hybrid Manager was successfully initialized') end |
Instance Method Details
#get_engine_tracking_code(visitor_variations) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/kameleoon/hybrid/manager.rb', line 27 def get_engine_tracking_code(visitor_variations) tracking_code = [TC_INIT] unless visitor_variations.nil? expired_time = (Time.now - @expiration_time).to_i visitor_variations.enumerate do |v| if v.assignment_time > expired_time v_code = format(TC_ASSIGN_VARIATION_TRIGGER_FORMAT, v.experiment_id, v.variation_id, v.experiment_id) tracking_code.push(v_code) end end end tracking_code.join end |