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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b99ce135ea2599d2b7eed9d8a99652741fb5e63
4
- data.tar.gz: d2a4c0f817404e112e425374c9647a675e687c86
3
+ metadata.gz: 68b075c639ff1ef723c81b9f60ff1ac8f517f1dd
4
+ data.tar.gz: df20ae610c9aa79b8204930fb3079f9edeb80132
5
5
  SHA512:
6
- metadata.gz: 32e40803fc1a40193395ff3220b23ce6ccb5c7d96cadedb68ea0f186783d2ab66396a49d1b4d31c5ec76c53bf5d3497a263a2df41107a2597e079ccb3354bb77
7
- data.tar.gz: 1229b0fe8d22740adbf0e04377dc490bd5f20366bfaacace608cf04f7b7d224b24aa80a483b59720ec18325cb3e04c9f3d1f5ab8047f1f5bec265c66b8a37741
6
+ metadata.gz: 4f1dd1e36834fe06efc1318c4847a4b6121cb4093534a193a6ca321a4f5762696699e89a7d675b71423b2d7323302eb68889def55a0aca4833cb662a0ea502aa
7
+ data.tar.gz: c6c2691cdd4fa3ba241e461930491324f31331fd675ba15edc9199ddefcb87fb7d456ae22e34e18ef1d18faf33437e202fa7ff9b17ba8568ac30279645f0f422
@@ -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
- Hash[@assigned_tests.map { |name, assigned_test| [name, assigned_test.variant] }]
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(meth, *args, &block)
34
+ def method_missing(*)
34
35
  @null_test ||= NullTest.new
35
36
  end
36
37
 
37
- def respond_to?(meth)
38
+ def respond_to?(*)
38
39
  true
39
40
  end
40
41
  end
data/lib/ab/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ab
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vinted-ab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras