bulk_loader 0.4.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bulk_loader/attribute.rb +20 -5
- data/lib/bulk_loader/dsl.rb +1 -2
- data/lib/bulk_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: 905e932ce017b63197cd743a2c856e50def0c6d52083d5c287a6d1463124f0e3
|
4
|
+
data.tar.gz: a6481e11d19e6eb455d5f54c5a2f9e736561cdd9c6dbe7ff3053ac06e9e7a711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2ef5b610d4635c521f0a04fef831e19b1b330473054cd2b99d8da340f6433bced83c2683f8b9125d5a186ce5c0a7fca31c8aa54a99501c85d1e629f42a81af
|
7
|
+
data.tar.gz: 49747836ca7331d9134deaad2ac9840a51c92a7ec0a5e48fc845e862a69300ce1cd1c035ec84be39258fe80d86caf448dd71019b6912b90260be788ad0bf4b2c
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
module BulkLoader
|
4
4
|
class Attribute
|
5
|
-
def initialize(
|
6
|
-
@class_attribute = cattr
|
5
|
+
def initialize(target)
|
7
6
|
@target = target
|
8
7
|
@lazy_of ||= {}
|
9
8
|
end
|
@@ -12,22 +11,38 @@ module BulkLoader
|
|
12
11
|
@lazy_of[name] ||= BulkLoader::Lazy.new(@target)
|
13
12
|
end
|
14
13
|
|
14
|
+
def marshal_dump
|
15
|
+
{
|
16
|
+
target: @target,
|
17
|
+
lazy_of: @lazy_of
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def marshal_load(obj)
|
22
|
+
@target = obj[:target]
|
23
|
+
@lazy_of = obj[:lazy_of]
|
24
|
+
end
|
25
|
+
|
26
|
+
def class_attribute
|
27
|
+
@target.class.bulk_loader
|
28
|
+
end
|
29
|
+
|
15
30
|
private
|
16
31
|
|
17
32
|
def method_missing(name, *args)
|
18
|
-
return super unless
|
33
|
+
return super unless class_attribute.include?(name)
|
19
34
|
|
20
35
|
names = [name].freeze
|
21
36
|
define_singleton_method(name) do
|
22
37
|
attr = lazy(name)
|
23
|
-
|
38
|
+
class_attribute.load(names, [self]) unless attr.loaded?
|
24
39
|
attr.get
|
25
40
|
end
|
26
41
|
public_send(name)
|
27
42
|
end
|
28
43
|
|
29
44
|
def respond_to_missing?(name, include_private)
|
30
|
-
return true if
|
45
|
+
return true if class_attribute.include?(name)
|
31
46
|
|
32
47
|
super
|
33
48
|
end
|
data/lib/bulk_loader/dsl.rb
CHANGED
@@ -36,8 +36,7 @@ module BulkLoader
|
|
36
36
|
def bulk_loader
|
37
37
|
return @bulk_loader if @bulk_loader
|
38
38
|
|
39
|
-
|
40
|
-
@bulk_loader = BulkLoader::Attribute.new(class_attribute, self)
|
39
|
+
@bulk_loader = BulkLoader::Attribute.new(self)
|
41
40
|
end
|
42
41
|
end
|
43
42
|
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: 1.0.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: 2019-09-
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|