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: e69b23ef012a6748604d4b82d1d81c791902ee23bc6179d231a340e48289a5d7
4
- data.tar.gz: 6233c958a32bfdeea0efaf5b5692d0e824a5e04d9d334bf002d519b0789d6cc3
3
+ metadata.gz: bf0b2d37f1b4dab2dd798faa601db7969c49479c02eb39ee67a1a7344231b887
4
+ data.tar.gz: aabcce88a49279d7d1d970e59056a43b866edd4d81d0a64cb553c0142b9da4c2
5
5
  SHA512:
6
- metadata.gz: eee96a99fe5217675f4ff9c3db4915571ae444c7af4a33ca763b786b51a07f77f55fe794aa004688ccfd0f6c00f478631ba100181625de5d5f8d503f62b85edb
7
- data.tar.gz: 1abc64ad140c4901e52f62b9a74f30e16f9fd4364a5e066f5321597c4246b7c5d7e2a0cba0515396b1a18aacd27d786321b17fa29004ed7336fac22a8ee75b06
6
+ metadata.gz: f9bd4b78d0c104dccaee61ac1ab1979596c2d90c9006c0e939cb26c8984401d7e724edfff81f4ff106b9a5d153ab1a687bf3d1bb963ecefa1929839e81a0183c
7
+ data.tar.gz: cbe3d31611bf98d43bd5cced27d68689bf739e04a87c023e96ede58b9ea500319ec907e2df6ce55f17ff752bc34c4c0e727ab34ed721b51130e251657d6764b3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.62)
4
+ ree_lib (1.0.63)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -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
- to_dto.call(value)
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 = value.map { to_dto.call(_1) }
297
+ value = if value.is_a?(Array)
298
+ value.map { to_dto.call(_1) }
295
299
  else
296
- value = to_dto.call(value)
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.62"
4
+ VERSION = "1.0.63"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.62
4
+ version: 1.0.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov