bulk_loader 0.1.0 → 0.2.0
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 +5 -5
- data/lib/bulk_loader/attribute.rb +2 -1
- data/lib/bulk_loader/class_attribute.rb +8 -8
- data/lib/bulk_loader/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f597dd144f901e0dfdd7118b2c4b3195f9de24a42344efebfd338bb79b2eb7f
|
4
|
+
data.tar.gz: '094b05be80e70f378067597d5197ec849828416513a7a5012b9932f741bca36d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c934949c8af3328af455fd1c0964e594f422346f68efae6a4b5dd58eb0d9cb4ee85b5fb0f0e2d994567d6e2d6ea74760d9dd7186de6ce722bc7d539592ddde2b
|
7
|
+
data.tar.gz: 35971ca21b9685d44755697520373484b60bdb68f9f5edbdbca45bec77e30dc5d3a88504526c6beb14ebd1ef55c2d9319fb5ae13db314f09e353d2655162530e
|
@@ -16,9 +16,10 @@ module BulkLoader
|
|
16
16
|
|
17
17
|
def method_missing(name, *args)
|
18
18
|
return super unless @class_attribute.include?(name)
|
19
|
+
names = [name].freeze
|
19
20
|
define_singleton_method(name) do
|
20
21
|
attr = lazy(name)
|
21
|
-
@class_attribute.load(
|
22
|
+
@class_attribute.load(names, [self]) unless attr.loaded?
|
22
23
|
attr.get
|
23
24
|
end
|
24
25
|
public_send(name)
|
@@ -10,6 +10,10 @@ module BulkLoader
|
|
10
10
|
@loader_of.include?(name)
|
11
11
|
end
|
12
12
|
|
13
|
+
def each(&block)
|
14
|
+
@loader_of.each(&block)
|
15
|
+
end
|
16
|
+
|
13
17
|
def load(loader_names, attributes, *args)
|
14
18
|
attrs = convert_attributes(attributes)
|
15
19
|
|
@@ -35,18 +39,14 @@ module BulkLoader
|
|
35
39
|
end
|
36
40
|
|
37
41
|
def convert_attributes(attributes)
|
38
|
-
|
39
|
-
attributes.each do |attr|
|
40
|
-
attrs.push(convert_attribute(attr))
|
41
|
-
end
|
42
|
-
attrs
|
42
|
+
attributes.map(&method(:convert_attribute))
|
43
43
|
end
|
44
44
|
|
45
45
|
def convert_attribute(attr)
|
46
|
-
if attr.respond_to?(:
|
47
|
-
attr
|
48
|
-
elsif attr.respond_to?(:bulk_loader)
|
46
|
+
if attr.respond_to?(:bulk_loader)
|
49
47
|
attr.bulk_loader
|
48
|
+
elsif attr.respond_to?(:lazy)
|
49
|
+
attr
|
50
50
|
else
|
51
51
|
raise 'attributes should be BulkLoader::Attribute or BulkLoader::DSL included class!!'
|
52
52
|
end
|
data/lib/bulk_loader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiji Yoshimi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.6.14
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: utility to avoid N+1 queries
|