vinted-ab 0.0.2 → 0.0.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_experiment.rb +1 -1
- data/lib/ab/experiment.rb +1 -1
- data/lib/ab/experiments.rb +8 -0
- data/lib/ab/version.rb +1 -1
- data/spec/experiments_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3566b6e9c6dc50f3ca1e435644b7e3bb1eab9fd1
|
4
|
+
data.tar.gz: 062d9118532a050d1155981c7ca4633911365421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a23e68efe7ebd7e8442f088feb526f1718338b4b41e94375de361deca94b865ad526634a4fd267999b6aebed3d4729d419a7a0a1bbc6159480e38e2b4516e42
|
7
|
+
data.tar.gz: 5f40b68ced5a8adf1f9eed2a34066e68ca94d7716419694bcba22004b3df738509a079d9eb37aeb3987bfecafd279c40114c7dbb7e03c8d9813acf89e90ec903
|
data/lib/ab/experiment.rb
CHANGED
data/lib/ab/experiments.rb
CHANGED
@@ -15,6 +15,7 @@ module Ab
|
|
15
15
|
|
16
16
|
(config['ab_tests'] || []).each do |experiment|
|
17
17
|
name = experiment['name']
|
18
|
+
@assigned_experiments[name] = nil
|
18
19
|
define_singleton_method(name) do
|
19
20
|
experiment = Experiment.new(experiment, config['salt'], config['bucket_count'])
|
20
21
|
@assigned_experiments[name] ||= AssignedExperiment.new(experiment, id)
|
@@ -22,6 +23,13 @@ module Ab
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def all
|
27
|
+
result = @assigned_experiments.keys.map do |name|
|
28
|
+
[name, send(name).variant]
|
29
|
+
end
|
30
|
+
Hash[result]
|
31
|
+
end
|
32
|
+
|
25
33
|
def method_missing(meth, *args, &block)
|
26
34
|
@null_experiment ||= NullExperiment.new
|
27
35
|
end
|
data/lib/ab/version.rb
CHANGED
data/spec/experiments_spec.rb
CHANGED
@@ -10,7 +10,7 @@ module Ab
|
|
10
10
|
let(:config) { {} }
|
11
11
|
|
12
12
|
specify 'has no public methods' do
|
13
|
-
(subject.public_methods(false) - [:method_missing, :respond_to
|
13
|
+
(subject.public_methods(false) - [:method_missing, :respond_to?, :all]).count.should == 0
|
14
14
|
end
|
15
15
|
|
16
16
|
specify 'does not raise if method is not existant' do
|
@@ -25,11 +25,13 @@ module Ab
|
|
25
25
|
'bucket_count' => 1000,
|
26
26
|
'ab_tests' => [{
|
27
27
|
'name' => 'feed',
|
28
|
+
'buckets' => 'all',
|
28
29
|
'variants' => [{ 'name' => 'enabled', 'chance_weight' => 1 }]
|
29
30
|
}]
|
30
31
|
}
|
31
32
|
}
|
32
33
|
its(:feed) { should be_kind_of AssignedExperiment }
|
34
|
+
its(:all) { should == { 'feed' => 'enabled' } }
|
33
35
|
end
|
34
36
|
end
|
35
37
|
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.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hooks
|