Class: Growthbook::InlineExperimentResult
- Inherits:
-
Object
- Object
- Growthbook::InlineExperimentResult
- Defined in:
- lib/growthbook/inline_experiment_result.rb
Overview
Result of running an experiment.
Instance Attribute Summary collapse
-
#bucket ⇒ Float
readonly
The hash value used to assign a variation (float from 0 to 1).
-
#feature_id ⇒ String?
readonly
The id of the feature (if any) that the experiment came from.
-
#hash_attribute ⇒ String
readonly
The user attribute used to assign a variation.
-
#hash_used ⇒ Bool
readonly
If a hash was used to assign a variation.
-
#hash_value ⇒ String
readonly
The value of that attribute.
-
#in_experiment ⇒ Boolean
readonly
Whether or not the user is part of the experiment.
-
#key ⇒ String
readonly
The unique key for the assigned variation.
-
#name ⇒ String?
readonly
Human-readable name for the experiment.
-
#passthrough ⇒ Boolean
Used for holdout groups.
-
#sticky_bucket_used ⇒ Boolean
When true, sticky bucketing was used to assign a variation.
-
#value ⇒ Any
readonly
The array value of the assigned variation.
-
#variation_id ⇒ Integer
readonly
The array index of the assigned variation.
Instance Method Summary collapse
-
#hash_used? ⇒ Bool
If the variation was randomly assigned based on user attribute hashes.
-
#in_experiment? ⇒ Bool
Whether or not the user is in the experiment.
-
#initialize(options = {}) ⇒ InlineExperimentResult
constructor
A new instance of InlineExperimentResult.
- #sticky_bucket_used? ⇒ Boolean
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ InlineExperimentResult
Returns a new instance of InlineExperimentResult.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/growthbook/inline_experiment_result.rb', line 42 def initialize( = {}) @key = [:key] @in_experiment = [:in_experiment] @variation_id = [:variation_id] @value = [:value] @hash_used = [:hash_used] @hash_attribute = [:hash_attribute] @hash_value = [:hash_value] @feature_id = [:feature_id] @bucket = [:bucket] @name = [:name] @passthrough = [:passthrough] @sticky_bucket_used = [:sticky_bucket_used] end |
Instance Attribute Details
#bucket ⇒ Float (readonly)
Returns The hash value used to assign a variation (float from 0 to 1).
31 32 33 |
# File 'lib/growthbook/inline_experiment_result.rb', line 31 def bucket @bucket end |
#feature_id ⇒ String? (readonly)
Returns The id of the feature (if any) that the experiment came from.
25 26 27 |
# File 'lib/growthbook/inline_experiment_result.rb', line 25 def feature_id @feature_id end |
#hash_attribute ⇒ String (readonly)
Returns The user attribute used to assign a variation.
19 20 21 |
# File 'lib/growthbook/inline_experiment_result.rb', line 19 def hash_attribute @hash_attribute end |
#hash_used ⇒ Bool (readonly)
Returns If a hash was used to assign a variation.
16 17 18 |
# File 'lib/growthbook/inline_experiment_result.rb', line 16 def hash_used @hash_used end |
#hash_value ⇒ String (readonly)
Returns The value of that attribute.
22 23 24 |
# File 'lib/growthbook/inline_experiment_result.rb', line 22 def hash_value @hash_value end |
#in_experiment ⇒ Boolean (readonly)
Returns Whether or not the user is part of the experiment.
7 8 9 |
# File 'lib/growthbook/inline_experiment_result.rb', line 7 def in_experiment @in_experiment end |
#key ⇒ String (readonly)
Returns The unique key for the assigned variation.
28 29 30 |
# File 'lib/growthbook/inline_experiment_result.rb', line 28 def key @key end |
#name ⇒ String? (readonly)
Returns Human-readable name for the experiment.
34 35 36 |
# File 'lib/growthbook/inline_experiment_result.rb', line 34 def name @name end |
#passthrough ⇒ Boolean
Returns Used for holdout groups.
37 38 39 |
# File 'lib/growthbook/inline_experiment_result.rb', line 37 def passthrough @passthrough end |
#sticky_bucket_used ⇒ Boolean
Returns When true, sticky bucketing was used to assign a variation.
40 41 42 |
# File 'lib/growthbook/inline_experiment_result.rb', line 40 def sticky_bucket_used @sticky_bucket_used end |
#value ⇒ Any (readonly)
Returns The array value of the assigned variation.
13 14 15 |
# File 'lib/growthbook/inline_experiment_result.rb', line 13 def value @value end |
#variation_id ⇒ Integer (readonly)
Returns The array index of the assigned variation.
10 11 12 |
# File 'lib/growthbook/inline_experiment_result.rb', line 10 def variation_id @variation_id end |
Instance Method Details
#hash_used? ⇒ Bool
If the variation was randomly assigned based on user attribute hashes
59 60 61 |
# File 'lib/growthbook/inline_experiment_result.rb', line 59 def hash_used? @hash_used end |
#in_experiment? ⇒ Bool
Whether or not the user is in the experiment
69 70 71 |
# File 'lib/growthbook/inline_experiment_result.rb', line 69 def in_experiment? @in_experiment end |
#sticky_bucket_used? ⇒ Boolean
63 64 65 |
# File 'lib/growthbook/inline_experiment_result.rb', line 63 def sticky_bucket_used? @sticky_bucket_used || false end |
#to_json(*_args) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/growthbook/inline_experiment_result.rb', line 73 def to_json(*_args) { 'inExperiment' => @in_experiment, 'variationId' => @variation_id, 'value' => @value, 'hashUsed' => @hash_used, 'hashAttribute' => @hash_attribute, 'hashValue' => @hash_value, 'featureId' => @feature_id.to_s, 'key' => @key.to_s, 'bucket' => @bucket, 'name' => @name, 'passthrough' => @passthrough, 'stickyBucketUsed' => @sticky_bucket_used }.compact end |