Sha256: db1f5ba2569defde9dc008ab1265ab255497cf254fd9fb528274016403519de5

Contents?: true

Size: 751 Bytes

Versions: 17

Compression:

Stored size: 751 Bytes

Contents

class TestTrack::Fake::Visitor
  attr_reader :id

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

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

  def self.reset!
    @instance = nil
    TestTrack::Fake::SplitRegistry.reset!
  end

  def initialize(id)
    @id = id
  end

  def assignments
    @assignments ||= _assignments
  end

  def split_registry
    TestTrack::SplitRegistry.new(TestTrack::Fake::SplitRegistry.instance.to_h)
  end

  private

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
test_track_rails_client-7.1.2 app/models/test_track/fake/visitor.rb
test_track_rails_client-7.1.1 app/models/test_track/fake/visitor.rb
test_track_rails_client-7.0.0 app/models/test_track/fake/visitor.rb
test_track_rails_client-6.0.0 app/models/test_track/fake/visitor.rb
test_track_rails_client-5.0.1 app/models/test_track/fake/visitor.rb
test_track_rails_client-5.0.0 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.2 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.1 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.rc3 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.rc2 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha35 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha34 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha33 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha32 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha31 app/models/test_track/fake/visitor.rb
test_track_rails_client-4.0.0.alpha30 app/models/test_track/fake/visitor.rb