Sha256: 8c18400c7b14ac6da15d28daeb9cf2491fb4d735c532eda7ad7ff479aa7367df
Contents?: true
Size: 791 Bytes
Versions: 7
Compression:
Stored size: 791 Bytes
Contents
require 'eeny-meeny/models/cookie' require 'eeny-meeny/models/experiment' module EenyMeeny::ExperimentHelper def participates_in?(experiment_id, variation_id: nil) experiment = EenyMeeny::Experiment.find_by_id(experiment_id) return unless !experiment.nil? && experiment.active? participant_variation_id = read_cookie(EenyMeeny::Cookie.cookie_name(experiment)) return if variation_id && variation_id.to_s != participant_variation_id experiment.find_variation(participant_variation_id) end def smoke_test?(smoke_test_id, version: 1) cookie = read_cookie(EenyMeeny::Cookie.smoke_test_name(smoke_test_id, version: version)) cookie unless cookie.nil? end private def read_cookie(cookie_name) EenyMeeny::Cookie.read(cookies[cookie_name]) end end
Version data entries
7 entries across 7 versions & 1 rubygems