vinted-ab 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ab/assigned_test.rb +3 -3
- data/lib/ab/tests.rb +4 -3
- data/lib/ab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68b075c639ff1ef723c81b9f60ff1ac8f517f1dd
|
4
|
+
data.tar.gz: df20ae610c9aa79b8204930fb3079f9edeb80132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f1dd1e36834fe06efc1318c4847a4b6121cb4093534a193a6ca321a4f5762696699e89a7d675b71423b2d7323302eb68889def55a0aca4833cb662a0ea502aa
|
7
|
+
data.tar.gz: c6c2691cdd4fa3ba241e461930491324f31331fd675ba15edc9199ddefcb87fb7d456ae22e34e18ef1d18faf33437e202fa7ff9b17ba8568ac30279645f0f422
|
data/lib/ab/assigned_test.rb
CHANGED
@@ -18,16 +18,16 @@ module Ab
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def variant
|
21
|
+
def variant(run_callbacks = true)
|
22
22
|
@variant ||= begin
|
23
23
|
return unless part_of_test?
|
24
24
|
return unless running?
|
25
25
|
|
26
|
-
AssignedTest.before.call(@test.name) if AssignedTest.before.respond_to?(:call)
|
26
|
+
AssignedTest.before.call(@test.name) if run_callbacks && AssignedTest.before.respond_to?(:call)
|
27
27
|
picked_variant = @test.variants.find { |v| v.accumulated_chance_weight > weight_id }
|
28
28
|
|
29
29
|
result = picked_variant.name if picked_variant
|
30
|
-
AssignedTest.after.call(@test.name, result) if AssignedTest.after.respond_to?(:call)
|
30
|
+
AssignedTest.after.call(@test.name, result) if run_callbacks && AssignedTest.after.respond_to?(:call)
|
31
31
|
result
|
32
32
|
end
|
33
33
|
end
|
data/lib/ab/tests.rb
CHANGED
@@ -27,14 +27,15 @@ module Ab
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def all
|
30
|
-
|
30
|
+
# TODO: temporary feature to support old Vinted ab testing system
|
31
|
+
Hash[@assigned_tests.map { |name, assigned_test| [name, assigned_test.variant(false)] }]
|
31
32
|
end
|
32
33
|
|
33
|
-
def method_missing(
|
34
|
+
def method_missing(*)
|
34
35
|
@null_test ||= NullTest.new
|
35
36
|
end
|
36
37
|
|
37
|
-
def respond_to?(
|
38
|
+
def respond_to?(*)
|
38
39
|
true
|
39
40
|
end
|
40
41
|
end
|
data/lib/ab/version.rb
CHANGED