ablab 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ablab.rb +3 -1
- data/lib/ablab/version.rb +1 -1
- data/spec/ablab_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0ea8de68dd059dc93af4147afa564a21013d2c3
|
4
|
+
data.tar.gz: 08b1cb3ab370d6b1d911c87f2fa17aadacbe30d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4192a527df2c3df978db666bacebe20e94b064c9fb8fd000dcf439381e76e0fd15fbacf55a71f8e6706ab00b306811cc6f78bfda86a97ab71f9583a8a26119b9
|
7
|
+
data.tar.gz: bee0012554b0699013555eb85361c5c042fa12427e8da40f4b9fd095a64541c72bccde8598ee5f5c02d92ac5da2090b7d7392e363e852ebc9b7033b327d787d2
|
data/lib/ablab.rb
CHANGED
@@ -112,7 +112,9 @@ module Ablab
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def draw
|
115
|
-
|
115
|
+
sid_hash = Digest::SHA1.hexdigest(session_id)[-8..-1].to_i(16)
|
116
|
+
exp_hash = Digest::SHA1.hexdigest(experiment.name.to_s)[-8..-1].to_i(16)
|
117
|
+
sid_hash ^ exp_hash % 1000
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
data/lib/ablab/version.rb
CHANGED
data/spec/ablab_spec.rb
CHANGED
@@ -183,5 +183,14 @@ describe Ablab do
|
|
183
183
|
allow(run).to receive(:draw).and_return 300
|
184
184
|
expect(run.group).to be_nil
|
185
185
|
end
|
186
|
+
|
187
|
+
describe "#draw" do
|
188
|
+
it "is stable across ruby processes" do
|
189
|
+
d1 = Ablab::Run.new(experiment, '8asd7f8asf7').draw
|
190
|
+
dir = File.expand_path(File.dirname(__FILE__), '../lib')
|
191
|
+
d2 = `bundle exec ruby -I#{dir} -e "require 'ablab'; require 'ostruct'; puts Ablab::Run.new(OpenStruct.new(name: :foo), '8asd7f8asf7').draw"`
|
192
|
+
expect(d1).to eq(d2.to_i)
|
193
|
+
end
|
194
|
+
end
|
186
195
|
end
|
187
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ablab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Ongaro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.5.1
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Ablab - A/B testing on Rails
|