vignette 0.0.5pre3 → 0.0.6pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,12 +40,8 @@ module ObjectExtensions
40
40
  choice = store[key] ||= rand(length) # Store key into storage if not available
41
41
  result = self[choice.to_i]
42
42
 
43
- # TODO: Make this clearer for how to store the test items
44
- if Vignette.session
45
- Vignette.session[:vignette] ||= {}
46
- Vignette.session[:vignette][:tests] ||= {}
47
- Vignette.session[:vignette][:tests][test_name] = result
48
- end
43
+ # Let's store keys where they are
44
+ store[:v] = ( store[:v].present? ? JSON(store[:v]) : {} ).merge(test_name => result).to_json
49
45
 
50
46
  return result
51
47
  end
@@ -1,3 +1,3 @@
1
1
  module Vignette
2
- VERSION = "0.0.5pre3"
2
+ VERSION = "0.0.6pre1"
3
3
  end
data/lib/vignette.rb CHANGED
@@ -40,8 +40,9 @@ module Vignette
40
40
  Vignette.request = Vignette.session = Vignette.cookies = nil # clear items
41
41
  end
42
42
 
43
- def self.tests(session=Vignette.session)
44
- ( session && session[:vignette] && session[:vignette][:tests] ? session[:vignette][:tests] : nil ) || {}
43
+ def self.tests(session=Vignette.session, cookies=Vignette.cookies)
44
+ store = get_store(session, cookies)
45
+ store && store[:v].present? ? JSON(store[:v]) : {}
45
46
  end
46
47
 
47
48
  def self.get_store(session=Vignette.session, cookies=Vignette.cookies)
@@ -49,7 +50,7 @@ module Vignette
49
50
  when :cookies
50
51
  raise VignetteError::ConfigError, "Missing cookies configuration in Vignette. Must access Vignette in controller within around_filter." if cookies.nil?
51
52
  Rails.logger.debug [ 'Vignette::vignette', 'Cookies Sampling', cookies ] if Vignette.logging
52
- cookies
53
+ cookies.signed
53
54
  when :session
54
55
  raise VignetteError::ConfigError, "Missing session configuration in Vignette. Must access Vignette in controller within around_filter." if session.nil?
55
56
  Rails.logger.debug [ 'Vignette::vignette', 'Session Sampling', session ] if Vignette.logging
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vignette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5pre3
4
+ version: 0.0.6pre1
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2013-11-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Simple, effective A/b testing made easy.
15
15
  email: