split_cat 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4880681278c9fc6b8581039569aee279d717ca70
4
- data.tar.gz: 4ec902b130f34eded678960ed766897ad2514726
3
+ metadata.gz: 452394b6cefb9d8e96ba04e3cbc6cb611244004e
4
+ data.tar.gz: cd630adea48b74ad271697ecee59028b275085d1
5
5
  SHA512:
6
- metadata.gz: fc167cf4abce19f129ff514b18faa9a3ba5d34ebcdf7ddf92b5ddfb855e7bbc716678901a791786a128d45790e7878f27c473402030848e95e7cd587ac652d7e
7
- data.tar.gz: 73600eff04eeb93dc395332a2eff862fa6dbb43e82a5af05715e9c378b5c6c397149c4b43b8482b9571373891bccd2f20db94140e62d9e27cc8d4bb2bfcde4a0
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:
@@ -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 cookies[ :split_cat_token ] && cookies[ :split_cat_token ][ :value ] &&
52
- !Subject.where( :token => cookies[ :split_cat_token ][ :value ] ).first
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 ] || !cookies[ :split_cat_token ]
56
+ if options[ :force ] || !@split_cat_token
57
57
  expires = SplitCat.config.cookie_expiration.from_now
58
- cookies[ :split_cat_token ] = { :value => split_cat_token, :expires => expires }
58
+ @split_cat_token = split_cat_token
59
+ cookies[ :split_cat_token ] = { :value => @split_cat_token, :expires => expires }
59
60
  end
60
61
 
61
- @split_cat_token = cookies[ :split_cat_token ]
62
+ return @split_cat_token
62
63
  end
63
64
 
64
65
  end
@@ -1,3 +1,3 @@
1
1
  module SplitCat
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end