planout 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -18
- data/lib/planout/version.rb +1 -1
- metadata +1 -2
- data/.gitignore +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5c5c1dd6ff42017cf545c0907f6787ea1f4d5a3
|
4
|
+
data.tar.gz: 1f07fd26a0d23f8bb5a168d72b7ae6ce719c4887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9811923bb113830dc50b5513e218b927bc4ca300ab8442c68e8ea14855b51f6086f52dc94d235b71da651dadf7dfff9be35978b3dc04d323049e519e5a2fbe9a
|
7
|
+
data.tar.gz: 0f86286b2428c19b46ac4f3bdcbff75cff14da944ab96d33dc76214ec7ce91e7a2ba32b62eba72603b23b4ba113cceec3c0cde67b2639bcd52c573c831b9f3ca
|
data/README.md
CHANGED
@@ -22,22 +22,25 @@ $ gem install planout
|
|
22
22
|
|
23
23
|
This defines a simple experiment that randomly assigns three variables, foo, bar, and baz.
|
24
24
|
`foo` and `baz` use `userid` as input, while `bar` uses a pair, namely `userid` combined with the value of `foo` from the prior step.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
module Planout
|
28
|
+
class VotingExperiment < SimpleExperiment
|
29
|
+
# Experiment#assign takes params and an input array
|
30
|
+
def assign(params, **inputs)
|
31
|
+
userid = inputs[:userid]
|
32
|
+
|
33
|
+
params[:button_color] = UniformChoice.new({
|
34
|
+
choices: ['ff0000', '#00ff00'],
|
35
|
+
unit: userid
|
36
|
+
})
|
37
|
+
|
38
|
+
params[:button_text] = UniformChoice.new({
|
39
|
+
choices: ["I'm voting", "I'm a voter"],
|
40
|
+
unit: userid,
|
41
|
+
salt:'x'
|
42
|
+
})
|
43
|
+
end
|
41
44
|
end
|
42
45
|
end
|
43
46
|
```
|
@@ -45,7 +48,7 @@ end
|
|
45
48
|
Then, we can examine the assignments produced for a few input userids. Note that since exposure logging is enabled by default, all of the experiments' inputs, configuration information, timestamp, and parameter assignments are pooped out via the Logger class.
|
46
49
|
|
47
50
|
```ruby
|
48
|
-
my_exp = VotingExperiment.new(userid: 14)
|
51
|
+
my_exp = Planout::VotingExperiment.new(userid: 14)
|
49
52
|
my_button_color = my_exp.get(:button_color)
|
50
53
|
button_text = my_exp.get(:button_text)
|
51
54
|
puts "button color is #{my_button_color} and button text is #{button_text}."
|
@@ -54,7 +57,7 @@ puts "button color is #{my_button_color} and button text is #{button_text}."
|
|
54
57
|
The output of the Ruby script looks something like this:
|
55
58
|
|
56
59
|
```ruby
|
57
|
-
logged data: {"name":"VotingExperiment","time":1404944726,"salt":"VotingExperiment","inputs":{"userid":14},"params":{"button_color":"ff0000","button_text":"I'm a voter"},"event":"exposure"}
|
60
|
+
logged data: {"name":"Planout::VotingExperiment","time":1404944726,"salt":"Planout::VotingExperiment","inputs":{"userid":14},"params":{"button_color":"ff0000","button_text":"I'm a voter"},"event":"exposure"}
|
58
61
|
|
59
62
|
button color is ff0000 and button text is I'm a voter.
|
60
63
|
```
|
data/lib/planout/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: planout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eytan Bakshy
|
@@ -63,7 +63,6 @@ executables: []
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
|
-
- ".gitignore"
|
67
66
|
- Gemfile
|
68
67
|
- LICENSE
|
69
68
|
- README.md
|