Class: Gitlab::Experiment::Rollout::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/experiment/rollout.rb

Direct Known Subclasses

Percent, Random, RoundRobin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



21
22
23
24
# File 'lib/gitlab/experiment/rollout.rb', line 21

def initialize(options = {})
  @options = options
  # validate! # we want to validate here, but we can't yet
end

Instance Attribute Details

#experimentObject (readonly)

Returns the value of attribute experiment.



17
18
19
# File 'lib/gitlab/experiment/rollout.rb', line 17

def experiment
  @experiment
end

Instance Method Details

#executeObject



36
37
38
# File 'lib/gitlab/experiment/rollout.rb', line 36

def execute
  variant_names.first
end

#rollout_for(experiment) ⇒ Object



26
27
28
29
30
# File 'lib/gitlab/experiment/rollout.rb', line 26

def rollout_for(experiment)
  @experiment = experiment
  validate! # until we have variant registration we can only validate here
  execute
end

#validate!Object



32
33
34
# File 'lib/gitlab/experiment/rollout.rb', line 32

def validate!
  # base is always valid
end