Sha256: b3a5fa6a0b6d1504b9caa3a108a32156dcd4c5bdaf5cd68fcd7c95459546682f

Contents?: true

Size: 689 Bytes

Versions: 8

Compression:

Stored size: 689 Bytes

Contents

class TestTrack::Fake::Visitor
  attr_reader :id

  Assignment = Struct.new(:split_name, :variant, :unsynced, :context, :visitor_id)

  def self.instance
    @instance ||= new(TestTrack::FakeServer.seed)
  end

  def self.reset!
    @instance = nil
  end

  def initialize(id)
    @id = id
  end

  def assignments
    @assignments ||= _assignments
  end

  def split_registry
    TestTrack::Fake::SplitRegistry.instance.to_h
  end

  private

  def _assignments
    split_registry.keys.map do |split_name|
      variant = TestTrack::VariantCalculator.new(visitor: self, split_name: split_name).variant
      Assignment.new(split_name, variant, false, "the_context", id)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
test_track_rails_client-4.0.0.alpha8 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha7 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha6 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha5 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha4 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha3 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha2 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha1 app/models/test_track/fake/visitor.rb