jit_preloader 1.0.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 515aa37a3edcd60ff85c7490bf7a96906a612c7b5645d3d81542c5e7997a9026
4
- data.tar.gz: 4cab1990cd0346da95d0d0785d28b18d5db95fecf66dbfcf14be26d0b020af5d
3
+ metadata.gz: '08fbd77fdcfc580733fbb24995cd80a1535bada8471f2dace6620ad000c25778'
4
+ data.tar.gz: bfb07a3212433bc5dd2a5a557ed05d0472f0ec227593a798a1b9442976815d57
5
5
  SHA512:
6
- metadata.gz: bf81adb00759b36e3bea5dfcaf9431c3259cac06412b57008e799585c7094d97073f836300a9631bd24fa0de7820874646861e7ea68e27cb773662d2e3826dec
7
- data.tar.gz: b96b45f91474ca01a5235d5ba071c750268e7c029fcfa371c308747433a5cb9f54bfb2560a99051c335352c8a536a01887ae01bb840337ee2e9ab3a808f5ec84
6
+ metadata.gz: c7fe821295fc841a48992f4fa93bbc372516509435a49455bf9e37543173fe089714198eaa9f0c355cf656d5c2696160c4c82bd657fad79edb9961d5e13e49c7
7
+ data.tar.gz: 33ae22de3c658a714be7b5c61705dcb82bdc1d762af3ee0d4ed084d29c6c9e8b6685fa3a353756f653c3287806d1eb946beb95df532983ce85536a82a8fab7fa
File without changes
@@ -1,7 +1,6 @@
1
1
  name: Ruby Gem
2
2
 
3
3
  on:
4
- workflow_dispatch:
5
4
  release:
6
5
  types: [ published ]
7
6
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activerecord", ">= 5.2", "< 7"
21
+ spec.add_dependency "activerecord", ">= 7", "< 8"
22
22
  spec.add_dependency "activesupport"
23
23
 
24
24
  spec.add_development_dependency "bundler"
@@ -33,11 +33,11 @@ module JitPreloadExtension
33
33
  end
34
34
  end
35
35
 
36
- preloader_association = ActiveRecord::Associations::Preloader.new.preload(
37
- records,
38
- base_association,
39
- preload_scope
40
- ).first
36
+ preloader_association = ActiveRecord::Associations::Preloader.new(
37
+ records: records,
38
+ associations: base_association,
39
+ scope: preload_scope
40
+ ).call.first
41
41
 
42
42
  records.each do |record|
43
43
  record.jit_preload_scoped_relations ||= {}
@@ -4,19 +4,18 @@ module JitPreloader
4
4
  attr_accessor :records
5
5
 
6
6
  def self.attach(records)
7
- new.tap do |loader|
8
- loader.records = records.dup
7
+ new(records: records.dup, associations: nil).tap do |loader|
9
8
  records.each do |record|
10
9
  record.jit_preloader = loader
11
10
  end
12
11
  end
13
12
  end
14
13
 
15
- def jit_preload(association)
14
+ def jit_preload(associations)
16
15
  # It is possible that the records array has multiple different classes (think single table inheritance).
17
16
  # Thus, it is possible that some of the records don't have an association.
18
- records_with_association = records.reject{|r| r.class.reflect_on_association(association).nil? }
19
- preload records_with_association, association
17
+ records_with_association = records.reject{|r| r.class.reflect_on_association(associations).nil? }
18
+ self.class.new(records: records_with_association, associations: associations).call
20
19
  end
21
20
 
22
21
  # We do not want the jit_preloader to be dumpable
@@ -1,3 +1,3 @@
1
1
  module JitPreloader
2
- VERSION = "1.0.4"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jit_preloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle d'Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '7'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
22
+ version: '8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.2'
29
+ version: '7'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '8'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +151,7 @@ executables: []
151
151
  extensions: []
152
152
  extra_rdoc_files: []
153
153
  files:
154
- - ".github/workflows/CODEOWNERS"
154
+ - ".github/CODEOWNERS"
155
155
  - ".github/workflows/gem-push.yml"
156
156
  - ".gitignore"
157
157
  - ".rspec"