Module: Gitlab::Experiment::Rollout

Defined in:
lib/gitlab/experiment/rollout.rb,
lib/gitlab/experiment/rollout/random.rb,
lib/gitlab/experiment/rollout/percent.rb,
lib/gitlab/experiment/rollout/round_robin.rb

Defined Under Namespace

Classes: Base, Percent, Random, RoundRobin, Strategy

Class Method Summary collapse

Class Method Details

.resolve(klass, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/experiment/rollout.rb', line 10

def self.resolve(klass, options = {})
  options ||= {}
  case klass
  when String
    Strategy.new(klass.classify.constantize, options)
  when Symbol
    Strategy.new("#{name}::#{klass.to_s.classify}".constantize, options)
  when Class
    Strategy.new(klass, options)
  else
    raise ArgumentError, "unable to resolve rollout from #{klass.inspect}"
  end
end