Class: Hackle::Experiment::Running
- Inherits:
-
Hackle::Experiment
- Object
- Hackle::Experiment
- Hackle::Experiment::Running
- Defined in:
- lib/hackle/models/experiment.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
Attributes inherited from Hackle::Experiment
Instance Method Summary collapse
- #get_overridden_variation(user:) ⇒ Variation?
- #get_variation(variation_id:) ⇒ Variation?
-
#initialize(id:, key:, bucket:, variations:, overrides:) ⇒ Running
constructor
A new instance of Running.
Constructor Details
#initialize(id:, key:, bucket:, variations:, overrides:) ⇒ Running
Returns a new instance of Running.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hackle/models/experiment.rb', line 28 def initialize(id:, key:, bucket:, variations:, overrides:) super(id: id, key: key) @bucket = bucket # @type [Hash{String => Variation}] @variations = variations # @type [Hash{String => Integer}] @overrides = overrides end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
21 22 23 |
# File 'lib/hackle/models/experiment.rb', line 21 def bucket @bucket end |
Instance Method Details
#get_overridden_variation(user:) ⇒ Variation?
47 48 49 50 51 |
# File 'lib/hackle/models/experiment.rb', line 47 def get_overridden_variation(user:) overridden_variation_id = @overrides[user.id] return nil if overridden_variation_id.nil? get_variation(variation_id: overridden_variation_id) end |
#get_variation(variation_id:) ⇒ Variation?
41 42 43 |
# File 'lib/hackle/models/experiment.rb', line 41 def get_variation(variation_id:) @variations[variation_id] end |