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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bullet.rb +9 -8
- data/lib/bullet/version.rb +1 -1
- data/spec/bullet_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0363cc75d4facd4a8b4a318312a421040d5b21d7ca81c0b3af21daaf7c2b60cd
|
4
|
+
data.tar.gz: ac0b0e4ed9c1641b5359b3d885ef854934b85b8ee21bc0486a4c3d2661e20853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199558c8186455fb2ddac94461d611d1c40eb0fb83ac68e36647efe0a34927020967a803cb24645b7ae3d5d045aa0060c604b455476f8c6aad6b5329103a7ebe
|
7
|
+
data.tar.gz: 86c4bcf9fcca52275229b7fa5e02919c39318d91a60c7fe956d4cab07442cbacfc3d9df134af1ee38bc7f153eeb2cd256faff45815ad83acd296c1831d1fc9ee
|
data/CHANGELOG.md
CHANGED
data/lib/bullet.rb
CHANGED
@@ -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
|
-
|
101
|
-
|
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
|
-
|
107
|
-
|
108
|
-
|
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(
|
113
|
+
Array(@whitelist[type][class_name])
|
113
114
|
end
|
114
115
|
|
115
116
|
def reset_whitelist
|
116
|
-
|
117
|
+
@whitelist ||= { n_plus_one_query: {}, unused_eager_loading: {}, counter_cache: {} }
|
117
118
|
end
|
118
119
|
|
119
120
|
def clear_whitelist
|
120
|
-
|
121
|
+
@whitelist = nil
|
121
122
|
end
|
122
123
|
|
123
124
|
def bullet_logger=(active)
|
data/lib/bullet/version.rb
CHANGED
data/spec/bullet_spec.rb
CHANGED
@@ -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(
|
91
|
+
expect(Bullet.whitelist[:n_plus_one_query]).to eq({})
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|