laboratory 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 55e19407d1d182b0d5f0a9530b0b18b739d0773c17755373d46309c78af10c99
4
- data.tar.gz: 5581f4f721d03c9608b17c6e028766c7642d42139e91489729c301fa1d0d6335
3
+ metadata.gz: e669860caa60d09934a3c3dc228de8c37315d38cbc954c27146187d8052f9c4b
4
+ data.tar.gz: 057b73763f3c9a27416ccf71ab44326f32a2c4b859272bca37fd608f83a8ce22
5
5
  SHA512:
6
- metadata.gz: 597b0b0be8cd204955109ede2e49d7a7c35b14380e6bf60fa93b8332ec2bdb19dd20b3067b1f21e5a37119115753d94f7b81c9ae54a67b4fa01b62c9fa510814
7
- data.tar.gz: 9716b7aa6e505c7082517c77cdf13647b7d02c6107ebf5e2fcc10d89837b429a8fe96808105b06849359f0d714ab846a2da9b35b10e86d791330d109f6ee1ddd
6
+ metadata.gz: 82b0763c658512eda404843648e7b3e3d3cc6200dd98bf2c90d7b710cf9e6a7979d8d1ea2bce94d59088174c7e4aa72bc4dbdf95a692f14402c3bc357971b4ad
7
+ data.tar.gz: 22dcdc22ee4afc615a296474636478212a2495eb9ebf089526bb431c36c24fd0b62c7811af2c1588eb17cf9c2a90d503e52f8e3900d4584b80d0864d4caf6ebb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- laboratory (0.1.3)
4
+ laboratory (0.1.4)
5
5
  redis (>= 2.1)
6
6
  sinatra (>= 1.2.6)
7
7
 
data/README.md CHANGED
@@ -49,7 +49,7 @@ Or install it yourself as:
49
49
  In an initializer (`app/config/initializers/laboratory.rb`), define the adapter you are going to use with Laboratory. Laboratory supports Redis out of the box, as it the recommended adapter:
50
50
 
51
51
  ```ruby
52
- Laboratory.config.adapter = Laboratory::Adapters::RedisAdapter.new(url: 'redis://localhost:6789') # Adjust to your redis URL.
52
+ Laboratory.adapter = Laboratory::Adapters::RedisAdapter.new(url: 'redis://localhost:6789') # Adjust to your redis URL.
53
53
  ```
54
54
 
55
55
  ### Defining your current_user_id & actor
@@ -2,7 +2,6 @@ module Laboratory
2
2
  class Config
3
3
  attr_accessor(
4
4
  :current_user_id,
5
- :adapter,
6
5
  :actor,
7
6
  :on_assignment_to_variant,
8
7
  :on_event_recorded
@@ -56,7 +56,7 @@ module Laboratory
56
56
  end
57
57
 
58
58
  def self.all
59
- Laboratory.config.adapter.read_all
59
+ Laboratory.adapter.read_all
60
60
  end
61
61
 
62
62
  def self.create(id:, variants:, algorithm: Algorithms::Random)
@@ -73,7 +73,7 @@ module Laboratory
73
73
  end
74
74
 
75
75
  def self.find(id)
76
- Laboratory.config.adapter.read(id)
76
+ Laboratory.adapter.read(id)
77
77
  end
78
78
 
79
79
  def self.find_or_create(id:, variants:, algorithm: Algorithms::Random)
@@ -81,7 +81,7 @@ module Laboratory
81
81
  end
82
82
 
83
83
  def delete
84
- Laboratory.config.adapter.delete(id)
84
+ Laboratory.adapter.delete(id)
85
85
  nil
86
86
  end
87
87
 
@@ -169,7 +169,7 @@ module Laboratory
169
169
 
170
170
  @changelog << changelog_item
171
171
  end
172
- Laboratory.config.adapter.write(self)
172
+ Laboratory.adapter.write(self)
173
173
  end
174
174
 
175
175
  def valid? # rubocop:disable Metrics/AbcSize
@@ -1,3 +1,3 @@
1
1
  module Laboratory
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
data/lib/laboratory.rb CHANGED
@@ -16,6 +16,8 @@ require 'laboratory/calculations/confidence_level'
16
16
 
17
17
  module Laboratory
18
18
  class << self
19
+ attr_accessor :adapter
20
+
19
21
  def config
20
22
  Thread.current[:laboratory_config] ||= Laboratory::Config.new
21
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laboratory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niall Paterson