Class: GovukAbTesting::AbTest
- Inherits:
-
Object
- Object
- GovukAbTesting::AbTest
- Defined in:
- lib/govuk_ab_testing/ab_test.rb
Instance Attribute Summary collapse
-
#ab_test_name ⇒ Object
(also: #name)
readonly
Returns the value of attribute ab_test_name.
-
#allowed_variants ⇒ Object
readonly
Returns the value of attribute allowed_variants.
-
#control_variant ⇒ Object
readonly
Returns the value of attribute control_variant.
-
#dimension ⇒ Object
readonly
Returns the value of attribute dimension.
Instance Method Summary collapse
-
#initialize(ab_test_name, dimension:, allowed_variants: %w(A B),, control_variant: 'A') ⇒ AbTest
constructor
for this specific A/B test possible variants.
- #meta_tag_name ⇒ Object
-
#request_header ⇒ Object
Internal name of the header.
-
#requested_variant(request_headers) ⇒ Object
the controller.
- #response_header ⇒ Object
Constructor Details
#initialize(ab_test_name, dimension:, allowed_variants: %w(A B),, control_variant: 'A') ⇒ AbTest
for this specific A/B test possible variants
16 17 18 19 20 21 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 16 def initialize(ab_test_name, dimension:, allowed_variants: %w(A B), control_variant: 'A') @ab_test_name = ab_test_name @dimension = dimension @allowed_variants = allowed_variants @control_variant = control_variant end |
Instance Attribute Details
#ab_test_name ⇒ Object (readonly) Also known as: name
Returns the value of attribute ab_test_name.
3 4 5 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 3 def ab_test_name @ab_test_name end |
#allowed_variants ⇒ Object (readonly)
Returns the value of attribute allowed_variants.
5 6 7 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 5 def allowed_variants @allowed_variants end |
#control_variant ⇒ Object (readonly)
Returns the value of attribute control_variant.
6 7 8 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 6 def control_variant @control_variant end |
#dimension ⇒ Object (readonly)
Returns the value of attribute dimension.
4 5 6 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 4 def dimension @dimension end |
Instance Method Details
#meta_tag_name ⇒ Object
38 39 40 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 38 def ab_test_name end |
#request_header ⇒ Object
Internal name of the header
30 31 32 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 30 def request_header "HTTP_GOVUK_ABTEST_#{ab_test_name.upcase}" end |
#requested_variant(request_headers) ⇒ Object
the controller.
25 26 27 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 25 def requested_variant(request_headers) RequestedVariant.new(self, request_headers, @dimension) end |
#response_header ⇒ Object
34 35 36 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 34 def response_header "GOVUK-ABTest-#{meta_tag_name}" end |