bullet 7.0.2 → 7.0.3

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: 9190b7377e0184967fec123b7926cc2287755989ceea1a4c90a949721d29f411
4
- data.tar.gz: 9ae038298d2367a5862eeb6480565f9ac9d104887b97f417e390266e0bfbdb8e
3
+ metadata.gz: ad1f81292cc89778a41c6dd178bbfb6342fe1b69c4e57c3fdad0d8003d97b525
4
+ data.tar.gz: 5c1c8113f6e03ecdb449bce5e12273b969f29c323a5bb802c13c0539ea439a69
5
5
  SHA512:
6
- metadata.gz: 5b8679cc1801319b7527c472be94d75a5df7a3e03a16f2ef444d3708de584f1f8985ceedd079c35c43cc9ffb39ee5a1664b5c12d38d3d194a686692495873612
7
- data.tar.gz: 6309d7925415f5a6339ab4e180a6ef0cd3d27c3308f3a39f6bbfa120c4cb0825f6c2728365942f71e810cb967504b72ad6fa2893334adb4ce6597299cbc4abbd
6
+ metadata.gz: 1f0d4d73910f96ab8c6ae5b6b1bc58de547c2c32a7c689c2984778465dae29d2c2cae81c23699b3848d2eaef30223db66bcca6ccb421b9078d5616f497421d45
7
+ data.tar.gz: 3b9001966918da22bfe7b2960526ac0db471a75e79e7939b099bebe3dde1fb27ea69b1afbdec0fcc98a6cb4260b845b5551a1a07cec036207c885be4e14ef7b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Next Release
2
2
 
3
+ ## 7.0.3 (08/13/2022)
4
+
5
+ * Replace `Array()` with `Array.wrap()`
6
+
3
7
  ## 7.0.2 (05/31/2022)
4
8
 
5
9
  * Drop growl support
@@ -179,7 +179,7 @@ module Bullet
179
179
  refl = reflection.through_reflection
180
180
  Bullet::Detector::NPlusOneQuery.call_association(owner, refl.name)
181
181
  association = owner.association refl.name
182
- Array(association.target).each do |through_record|
182
+ Array.wrap(association.target).each do |through_record|
183
183
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
184
184
  end
185
185
 
@@ -152,7 +152,7 @@ module Bullet
152
152
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
153
153
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
154
154
  association = owner.association reflection.through_reflection.name
155
- Array(association.target).each do |through_record|
155
+ Array.wrap(association.target).each do |through_record|
156
156
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
157
157
  end
158
158
 
@@ -199,7 +199,7 @@ module Bullet
199
199
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
200
200
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
201
201
  association = owner.association reflection.through_reflection.name
202
- Array(association.target).each do |through_record|
202
+ Array.wrap(association.target).each do |through_record|
203
203
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
204
204
  end
205
205
 
@@ -179,7 +179,7 @@ module Bullet
179
179
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
180
180
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
181
181
  association = owner.association(reflection.through_reflection.name)
182
- Array(association.target).each do |through_record|
182
+ Array.wrap(association.target).each do |through_record|
183
183
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
184
184
  end
185
185
 
@@ -226,7 +226,7 @@ module Bullet
226
226
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
227
227
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
228
228
  association = owner.association(reflection.through_reflection.name)
229
- Array(association.target).each do |through_record|
229
+ Array.wrap(association.target).each do |through_record|
230
230
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
231
231
  end
232
232
 
@@ -179,7 +179,7 @@ module Bullet
179
179
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
180
180
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
181
181
  association = owner.association(reflection.through_reflection.name)
182
- Array(association.target).each do |through_record|
182
+ Array.wrap(association.target).each do |through_record|
183
183
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
184
184
  end
185
185
 
@@ -226,7 +226,7 @@ module Bullet
226
226
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
227
227
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
228
228
  association = owner.association(reflection.through_reflection.name)
229
- Array(association.target).each do |through_record|
229
+ Array.wrap(association.target).each do |through_record|
230
230
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
231
231
  end
232
232
 
@@ -182,7 +182,7 @@ module Bullet
182
182
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
183
183
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
184
184
  association = owner.association(reflection.through_reflection.name)
185
- Array(association.target).each do |through_record|
185
+ Array.wrap(association.target).each do |through_record|
186
186
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
187
187
  end
188
188
 
@@ -229,7 +229,7 @@ module Bullet
229
229
  if is_a? ::ActiveRecord::Associations::ThroughAssociation
230
230
  Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
231
231
  association = owner.association(reflection.through_reflection.name)
232
- Array(association.target).each do |through_record|
232
+ Array.wrap(association.target).each do |through_record|
233
233
  Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
234
234
  end
235
235
 
@@ -20,7 +20,7 @@ module Bullet
20
20
  return unless Bullet.start?
21
21
  return unless Bullet.counter_cache_enable?
22
22
 
23
- objects = Array(object_or_objects)
23
+ objects = Array.wrap(object_or_objects)
24
24
  return if objects.map(&:bullet_primary_key_value).compact.empty?
25
25
 
26
26
  Bullet.debug(
@@ -54,7 +54,7 @@ module Bullet
54
54
  private
55
55
 
56
56
  def create_notification(klazz, associations)
57
- notify_associations = Array(associations) - Bullet.get_safelist_associations(:counter_cache, klazz)
57
+ notify_associations = Array.wrap(associations) - Bullet.get_safelist_associations(:counter_cache, klazz)
58
58
 
59
59
  if notify_associations.present?
60
60
  notice = Bullet::Notification::CounterCache.new klazz, notify_associations
@@ -7,7 +7,7 @@ module Bullet
7
7
  extend StackTraceFilter
8
8
 
9
9
  class << self
10
- # executed when object.assocations is called.
10
+ # executed when object.associations is called.
11
11
  # first, it keeps this method call for object.association.
12
12
  # then, it checks if this associations call is unpreload.
13
13
  # if it is, keeps this unpreload associations and caller.
@@ -33,7 +33,7 @@ module Bullet
33
33
  return unless Bullet.start?
34
34
  return unless Bullet.n_plus_one_query_enable?
35
35
 
36
- objects = Array(object_or_objects)
36
+ objects = Array.wrap(object_or_objects)
37
37
  return if objects.map(&:bullet_primary_key_value).compact.empty?
38
38
  return if objects.all? { |obj| obj.class.name =~ /^HABTM_/ }
39
39
 
@@ -95,7 +95,7 @@ module Bullet
95
95
  private
96
96
 
97
97
  def create_notification(callers, klazz, associations)
98
- notify_associations = Array(associations) - Bullet.get_safelist_associations(:n_plus_one_query, klazz)
98
+ notify_associations = Array.wrap(associations) - Bullet.get_safelist_associations(:n_plus_one_query, klazz)
99
99
 
100
100
  if notify_associations.present?
101
101
  notice = Bullet::Notification::NPlusOneQuery.new(callers, klazz, notify_associations)
@@ -10,7 +10,7 @@ module Bullet
10
10
  # check if there are unused preload associations.
11
11
  # get related_objects from eager_loadings associated with object and associations
12
12
  # get call_object_association from associations of call_object_associations whose object is in related_objects
13
- # if association not in call_object_association, then the object => association - call_object_association is ununsed preload assocations
13
+ # if association not in call_object_association, then the object => association - call_object_association is ununsed preload associations
14
14
  def check_unused_preload_associations
15
15
  return unless Bullet.start?
16
16
  return unless Bullet.unused_eager_loading_enable?
@@ -65,7 +65,7 @@ module Bullet
65
65
  private
66
66
 
67
67
  def create_notification(callers, klazz, associations)
68
- notify_associations = Array(associations) - Bullet.get_safelist_associations(:unused_eager_loading, klazz)
68
+ notify_associations = Array.wrap(associations) - Bullet.get_safelist_associations(:unused_eager_loading, klazz)
69
69
 
70
70
  if notify_associations.present?
71
71
  notice = Bullet::Notification::UnusedEagerLoading.new(callers, klazz, notify_associations)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullet
4
- VERSION = '7.0.2'
4
+ VERSION = '7.0.3'
5
5
  end
data/lib/bullet.rb CHANGED
@@ -109,7 +109,7 @@ module Bullet
109
109
  end
110
110
 
111
111
  def get_safelist_associations(type, class_name)
112
- Array(@safelist[type][class_name])
112
+ Array.wrap(@safelist[type][class_name])
113
113
  end
114
114
 
115
115
  def reset_safelist
@@ -39,7 +39,7 @@ module Bullet
39
39
 
40
40
  it 'should be false if object, association pair is not existed' do
41
41
  NPlusOneQuery.add_object_associations(@post, :association1)
42
- expect(NPlusOneQuery.association?(@post, :associatio2)).to eq false
42
+ expect(NPlusOneQuery.association?(@post, :association2)).to eq false
43
43
  end
44
44
  end
45
45
 
@@ -92,7 +92,7 @@ module Support
92
92
  page3 = Page.create(name: 'page3', parent_id: folder2.id, author_id: author2.id)
93
93
  page4 = Page.create(name: 'page4', parent_id: folder2.id, author_id: author2.id)
94
94
 
95
- role1 = Role.create(name: 'Amdin')
95
+ role1 = Role.create(name: 'Admin')
96
96
  role2 = Role.create(name: 'User')
97
97
 
98
98
  user1 = User.create(name: 'user1', category: category1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport