Sha256: 0fbe1b5db5d9b29eb6c8bb561db7c4695a73684b0bfc9ae748ab3605862a859f
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
class TestTrack::WebSessionVisitorRepository attr_reader :current_identity, :unauthenticated_visitor_id def initialize(current_identity:, unauthenticated_visitor_id:) @current_identity = current_identity @unauthenticated_visitor_id = unauthenticated_visitor_id end def current if current_identity for_identity(current_identity) else unauthenticated end end def for_identity(identity) identity_visitor_map[identity] ||= TestTrack::LazyVisitorByIdentity.new(identity) end def forget_unauthenticated! @unauthenticated = TestTrack::Visitor.new end def authenticate!(identity) @current_identity = identity identity_visitor_map[identity] = unauthenticated unauthenticated.link_identity!(identity) end def all identity_visitor_map.values.to_set << current end def notify_unsynced_assignments! all.each do |visitor| if visitor.loaded? && visitor.unsynced_assignments.present? TestTrack::ThreadedVisitorNotifier.new(visitor).notify end end end private def unauthenticated @unauthenticated ||= TestTrack::Visitor.new(id: unauthenticated_visitor_id) end def identity_visitor_map @identity_visitor_map ||= {} end end
Version data entries
4 entries across 4 versions & 1 rubygems