split_cat 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/split_cat/helpers.rb +7 -6
- data/lib/split_cat/version.rb +1 -1
- data/spec/dummy/log/test.log +17194 -0
- data/spec/lib/split_cat/helpers_spec.rb +1 -0
- metadata +2 -4
- data/spec/dummy/tmp/pids/server.pid +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 452394b6cefb9d8e96ba04e3cbc6cb611244004e
|
4
|
+
data.tar.gz: cd630adea48b74ad271697ecee59028b275085d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e170f44d7edcf458da422e559692f12ba16908a6d593c3f43b8a943c9fc888ac95f42671c29f38f6553f35ed03cc0001ed59f8355d3adbdd5704f164d9fb48c
|
7
|
+
data.tar.gz: 458039df700130278f2ee88731f8342f8984d8976f8432cafa8714f60cfbb9872cf6e6f12f6841887d4f24f7a0ae65f60cb47121eafa849457cdaf33c850815f
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ Create or add to `config/initializers/split_cat.rb`:
|
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
|
-
### Implement Hypotheses
|
80
|
+
### Implement Hypotheses Views
|
81
81
|
|
82
82
|
Create partials for each hypothesis. e.g. `button_a.html.erb` and `button_b.html.erb`
|
83
83
|
|
@@ -87,6 +87,13 @@ When rendering the partial, scope it with the experiment:
|
|
87
87
|
|
88
88
|
This will cause the partial to use the hypothesis assigned for the user/token.
|
89
89
|
|
90
|
+
### Implement Hypothesis Logic
|
91
|
+
|
92
|
+
You can get a raw hypothesis symbol for logic-based experiments:
|
93
|
+
|
94
|
+
hypothesis = split_cat_hypothesis( name, token )
|
95
|
+
do_something if hypothesis == :a
|
96
|
+
|
90
97
|
### Record Goals
|
91
98
|
|
92
99
|
Call `split_cat_goal` to record a goal achieved by a user:
|
data/lib/split_cat/helpers.rb
CHANGED
@@ -45,20 +45,21 @@ module SplitCat
|
|
45
45
|
# #set_split_cat_cookie
|
46
46
|
|
47
47
|
def set_split_cat_cookie( options = {} )
|
48
|
+
@split_cat_token = cookies[ :split_cat_token ]
|
48
49
|
|
49
50
|
# Create a Subject for the cookie token, if it doesn't exist
|
50
51
|
|
51
|
-
if
|
52
|
-
|
53
|
-
split_cat_token( cookies[ :split_cat_token ] )
|
52
|
+
if @split_cat_token && !Subject.where( :token => @split_cat_token ).first
|
53
|
+
split_cat_token( @split_cat_token )
|
54
54
|
end
|
55
55
|
|
56
|
-
if options[ :force ] ||
|
56
|
+
if options[ :force ] || !@split_cat_token
|
57
57
|
expires = SplitCat.config.cookie_expiration.from_now
|
58
|
-
|
58
|
+
@split_cat_token = split_cat_token
|
59
|
+
cookies[ :split_cat_token ] = { :value => @split_cat_token, :expires => expires }
|
59
60
|
end
|
60
61
|
|
61
|
-
|
62
|
+
return @split_cat_token
|
62
63
|
end
|
63
64
|
|
64
65
|
end
|
data/lib/split_cat/version.rb
CHANGED