Class: Gitlab::Experiment::Rollout::Base
- Inherits:
-
Object
- Object
- Gitlab::Experiment::Rollout::Base
- Defined in:
- lib/gitlab/experiment/rollout.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#experiment ⇒ Object
readonly
Returns the value of attribute experiment.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#initialize(experiment, options = {}) ⇒ Base
constructor
A new instance of Base.
- #resolve ⇒ Object
Constructor Details
#initialize(experiment, options = {}) ⇒ Base
Returns a new instance of Base.
29 30 31 32 33 34 |
# File 'lib/gitlab/experiment/rollout.rb', line 29 def initialize(experiment, = {}) raise ArgumentError, 'you must provide an experiment instance' unless experiment.class <= Gitlab::Experiment @experiment = experiment @options = end |
Instance Attribute Details
#experiment ⇒ Object (readonly)
Returns the value of attribute experiment.
25 26 27 |
# File 'lib/gitlab/experiment/rollout.rb', line 25 def experiment @experiment end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/gitlab/experiment/rollout.rb', line 25 def @options end |
Instance Method Details
#enabled? ⇒ Boolean
36 37 38 |
# File 'lib/gitlab/experiment/rollout.rb', line 36 def enabled? true end |
#resolve ⇒ Object
40 41 42 43 44 45 |
# File 'lib/gitlab/experiment/rollout.rb', line 40 def resolve validate! # allow the rollout strategy to validate itself assignment = execute_assignment assignment == :control ? nil : assignment # avoid caching control by returning nil end |