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.
-
#dimension ⇒ Object
readonly
Returns the value of attribute dimension.
Instance Method Summary collapse
-
#initialize(ab_test_name, dimension:) ⇒ AbTest
constructor
for this specific A/B test.
- #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:) ⇒ AbTest
for this specific A/B test
11 12 13 14 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 11 def initialize(ab_test_name, dimension:) @ab_test_name = ab_test_name @dimension = dimension 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 |
#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
31 32 33 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 31 def ab_test_name end |
#request_header ⇒ Object
Internal name of the header
23 24 25 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 23 def request_header "HTTP_GOVUK_ABTEST_#{ab_test_name.upcase}" end |
#requested_variant(request_headers) ⇒ Object
the controller.
18 19 20 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 18 def requested_variant(request_headers) RequestedVariant.new(self, request_headers, @dimension) end |
#response_header ⇒ Object
27 28 29 |
# File 'lib/govuk_ab_testing/ab_test.rb', line 27 def response_header "GOVUK-ABTest-#{meta_tag_name}" end |