n1_loader 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/n1_loader/core/preloader.rb +12 -2
- data/lib/n1_loader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc06934b6c230d9b48dce18c7e9ee49afad4ab32d51d4550eb3e2916fe977656
|
4
|
+
data.tar.gz: 456575999736bba2b4b8f33ff02a4908a7705b2cc31875bca9c80f3dbeeb4125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4640cffcc0fe6e03672ba46fc16e9fc29fc33d1c18b6d9e54e4c6026cd0d0b465846a60e0b75ab0dec46fd4db21ae914a0f92d3cc4623e622b4782094d6ce680
|
7
|
+
data.tar.gz: a010ffac1ce7604ce9434de734fa20f0e5162ff7307f6ddcafe0b9be1119a4f37d3774b7dd4beb8d36affd56e4f30830d01904406ce1f2b2fc2989d7f9910fa1
|
data/CHANGELOG.md
CHANGED
@@ -17,13 +17,23 @@ module N1Loader
|
|
17
17
|
def preload(*keys)
|
18
18
|
keys.flatten(1).flat_map do |key|
|
19
19
|
elements
|
20
|
-
.group_by { |element| element
|
20
|
+
.group_by { |element| loader_class(element, key) }
|
21
21
|
.map do |loader_class, grouped_elements|
|
22
|
+
next unless loader_class
|
23
|
+
|
22
24
|
loader_collection = N1Loader::LoaderCollection.new(loader_class, grouped_elements)
|
23
25
|
grouped_elements.each { |grouped_element| grouped_element.n1_loader_set(key, loader_collection) }
|
24
26
|
loader_collection
|
25
|
-
end
|
27
|
+
end.compact
|
26
28
|
end
|
27
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def loader_class(element, key)
|
34
|
+
element.class.respond_to?(:n1_loader_defined?) &&
|
35
|
+
element.class.n1_loader_defined?(key) &&
|
36
|
+
element.class.n1_loader(key)
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
data/lib/n1_loader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: n1_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|