ree_lib 1.0.62 → 1.0.63
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf0b2d37f1b4dab2dd798faa601db7969c49479c02eb39ee67a1a7344231b887
|
4
|
+
data.tar.gz: aabcce88a49279d7d1d970e59056a43b866edd4d81d0a64cb553c0142b9da4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9bd4b78d0c104dccaee61ac1ab1979596c2d90c9006c0e939cb26c8984401d7e724edfff81f4ff106b9a5d153ab1a687bf3d1bb963ecefa1929839e81a0183c
|
7
|
+
data.tar.gz: cbe3d31611bf98d43bd5cced27d68689bf739e04a87c023e96ede58b9ea500319ec907e2df6ce55f17ff752bc34c4c0e727ab34ed721b51130e251657d6764b3
|
data/Gemfile.lock
CHANGED
@@ -273,7 +273,11 @@ module ReeDao
|
|
273
273
|
if setter && setter.is_a?(Proc)
|
274
274
|
if to_dto
|
275
275
|
assoc_index = transform_values(association_index) do |key, value|
|
276
|
-
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.map { to_dto.call(_1) }
|
278
|
+
else
|
279
|
+
to_dto.call(value)
|
280
|
+
end
|
277
281
|
end
|
278
282
|
|
279
283
|
self.instance_exec(item, assoc_index, &assoc_setter)
|
@@ -290,16 +294,14 @@ module ReeDao
|
|
290
294
|
value = association_index[item.send(key)]
|
291
295
|
|
292
296
|
if to_dto && !value.nil?
|
293
|
-
if value.is_a?(Array)
|
294
|
-
value
|
297
|
+
value = if value.is_a?(Array)
|
298
|
+
value.map { to_dto.call(_1) }
|
295
299
|
else
|
296
|
-
|
300
|
+
to_dto.call(value)
|
297
301
|
end
|
298
302
|
end
|
299
303
|
|
300
|
-
if value.nil? && multiple
|
301
|
-
value = []
|
302
|
-
end
|
304
|
+
value = [] if value.nil? && multiple
|
303
305
|
|
304
306
|
begin
|
305
307
|
item.send(assoc_setter, value)
|
@@ -43,7 +43,7 @@ module ReeDao
|
|
43
43
|
def belongs_to(assoc_name, opts = nil, &block)
|
44
44
|
association(__method__, assoc_name, opts, &block)
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
contract(
|
48
48
|
Symbol,
|
49
49
|
Nilor[Proc, Sequel::Dataset],
|
@@ -52,7 +52,7 @@ module ReeDao
|
|
52
52
|
def has_one(assoc_name, opts = nil, &block)
|
53
53
|
association(__method__, assoc_name, opts, &block)
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
contract(
|
57
57
|
Symbol,
|
58
58
|
Nilor[Proc, Sequel::Dataset],
|
@@ -61,7 +61,7 @@ module ReeDao
|
|
61
61
|
def has_many(assoc_name, opts = nil, &block)
|
62
62
|
association(__method__, assoc_name, opts, &block)
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
contract(Symbol, Proc => Any)
|
66
66
|
def field(assoc_name, proc)
|
67
67
|
association(__method__, assoc_name, proc)
|
@@ -83,8 +83,9 @@ module ReeDao
|
|
83
83
|
def association(assoc_type, assoc_name, opts, &block)
|
84
84
|
if self.class.sync_mode?
|
85
85
|
return if association_is_not_included?(assoc_name) || list.empty?
|
86
|
-
|
86
|
+
|
87
87
|
association = Association.new(self, parent_dao_name, list, **global_opts)
|
88
|
+
|
88
89
|
if assoc_type == :field
|
89
90
|
association.handle_field(assoc_name, opts)
|
90
91
|
else
|
@@ -92,14 +93,14 @@ module ReeDao
|
|
92
93
|
end
|
93
94
|
else
|
94
95
|
if association_is_not_included?(assoc_name) || list.empty?
|
95
|
-
return { association_threads: @assoc_threads, field_threads: @field_threads }
|
96
|
+
return { association_threads: @assoc_threads, field_threads: @field_threads }
|
96
97
|
end
|
97
98
|
|
98
99
|
association = Association.new(self, parent_dao_name, list, **global_opts)
|
99
100
|
|
100
101
|
if assoc_type == :field
|
101
102
|
field_proc = opts
|
102
|
-
{
|
103
|
+
{
|
103
104
|
association_threads: @assoc_threads,
|
104
105
|
field_threads: @field_threads << [
|
105
106
|
association, field_proc
|
@@ -125,7 +126,7 @@ module ReeDao
|
|
125
126
|
|
126
127
|
if only && !only.include?(assoc_name)
|
127
128
|
return false if autoload_children
|
128
|
-
return true
|
129
|
+
return true
|
129
130
|
end
|
130
131
|
end
|
131
132
|
|
data/lib/ree_lib/version.rb
CHANGED