bullet 6.1.1 → 6.1.2

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: 6d02240600f13580ed16200edd5c39563bec1cb49a46ccbc82c57cff73a46e2f
4
- data.tar.gz: 0f40a4a1fe6157dabec88cb0ecc817168eda794aa1177c41ede1df351695d76a
3
+ metadata.gz: 0363cc75d4facd4a8b4a318312a421040d5b21d7ca81c0b3af21daaf7c2b60cd
4
+ data.tar.gz: ac0b0e4ed9c1641b5359b3d885ef854934b85b8ee21bc0486a4c3d2661e20853
5
5
  SHA512:
6
- metadata.gz: 1d3d3ce81767ce81091ddd7412dd8f341190ffac085477cde3ea04fa1ed696661f84be64d9c1fb6e6a0de276788e56f18aaada213df712cb51e6efb0a577ec37
7
- data.tar.gz: a3633af514a31e0ad6ff317a98616ed2c6c3ce070109288b8514c80277d4098359ed25a60bd5bcc4cd0ebf469f156751fa707f8d410f010bfcb8828e206e08a3
6
+ metadata.gz: 199558c8186455fb2ddac94461d611d1c40eb0fb83ac68e36647efe0a34927020967a803cb24645b7ae3d5d045aa0060c604b455476f8c6aad6b5329103a7ebe
7
+ data.tar.gz: 86c4bcf9fcca52275229b7fa5e02919c39318d91a60c7fe956d4cab07442cbacfc3d9df134af1ee38bc7f153eeb2cd256faff45815ad83acd296c1831d1fc9ee
@@ -1,5 +1,9 @@
1
1
  ## Next Release
2
2
 
3
+ ## 6.1.2 (12/12/2020)
4
+
5
+ * Revert "Make whitelist thread safe"
6
+
3
7
  ## 6.1.1 (12/12/2020)
4
8
 
5
9
  * Add support Rails 6.1
@@ -38,6 +38,7 @@ module Bullet
38
38
  :stacktrace_includes,
39
39
  :stacktrace_excludes,
40
40
  :skip_html_injection
41
+ attr_reader :whitelist
41
42
  attr_accessor :add_footer, :orm_patches_applied
42
43
 
43
44
  available_notifiers = UniformNotifier::AVAILABLE_NOTIFIERS.map { |notifier| "#{notifier}=" }
@@ -97,27 +98,27 @@ module Bullet
97
98
 
98
99
  def add_whitelist(options)
99
100
  reset_whitelist
100
- Thread.current[:whitelist][options[:type]][options[:class_name]] ||= []
101
- Thread.current[:whitelist][options[:type]][options[:class_name]] << options[:association].to_sym
101
+ @whitelist[options[:type]][options[:class_name]] ||= []
102
+ @whitelist[options[:type]][options[:class_name]] << options[:association].to_sym
102
103
  end
103
104
 
104
105
  def delete_whitelist(options)
105
106
  reset_whitelist
106
- Thread.current[:whitelist][options[:type]][options[:class_name]] ||= []
107
- Thread.current[:whitelist][options[:type]][options[:class_name]].delete(options[:association].to_sym)
108
- Thread.current[:whitelist][options[:type]].delete_if { |_key, val| val.empty? }
107
+ @whitelist[options[:type]][options[:class_name]] ||= []
108
+ @whitelist[options[:type]][options[:class_name]].delete(options[:association].to_sym)
109
+ @whitelist[options[:type]].delete_if { |_key, val| val.empty? }
109
110
  end
110
111
 
111
112
  def get_whitelist_associations(type, class_name)
112
- Array(Thread.current[:whitelist][type][class_name])
113
+ Array(@whitelist[type][class_name])
113
114
  end
114
115
 
115
116
  def reset_whitelist
116
- Thread.current[:whitelist] ||= { n_plus_one_query: {}, unused_eager_loading: {}, counter_cache: {} }
117
+ @whitelist ||= { n_plus_one_query: {}, unused_eager_loading: {}, counter_cache: {} }
117
118
  end
118
119
 
119
120
  def clear_whitelist
120
- Thread.current[:whitelist] = nil
121
+ @whitelist = nil
121
122
  end
122
123
 
123
124
  def bullet_logger=(active)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullet
4
- VERSION = '6.1.1'
4
+ VERSION = '6.1.2'
5
5
  end
@@ -88,7 +88,7 @@ describe Bullet, focused: true do
88
88
  it 'is deleted from the whitelist successfully' do
89
89
  Bullet.add_whitelist(type: :n_plus_one_query, class_name: 'Klass', association: :department)
90
90
  Bullet.delete_whitelist(type: :n_plus_one_query, class_name: 'Klass', association: :department)
91
- expect(Thread.current[:whitelist][:n_plus_one_query]).to eq({})
91
+ expect(Bullet.whitelist[:n_plus_one_query]).to eq({})
92
92
  end
93
93
  end
94
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang