ree_lib 1.0.57 → 1.0.58

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: 84ad4225d13e31575c1799fd4c7a4b480a1e7ae6b9709834447a733a3a260367
4
- data.tar.gz: ba98679b88ac6ad2cec30fcd0280c01638220fdd0a7488f8f33c7ead0dd2de7d
3
+ metadata.gz: bdb25650f338b4be087e72a1ef04fff5b9e1bf47d0b22221ead03743c74de398
4
+ data.tar.gz: 333d7adc841964ddd5b50d690f6c016b096622ba327953ae5a5fa57d50f7bde1
5
5
  SHA512:
6
- metadata.gz: ccbda33bb5233fc869f470993a93ec1770471e6fdce354a49455bf15c487731b06384bb776ed762c172e75428d77a071fc4483087cdbd2de8ef780729ccae3ac
7
- data.tar.gz: d24649974cf1ca2f05c0bece050a7aa91450244cc065f972acacef6f7d966ee52f285c458cf9925d76693b14862d9ebfe77d42142dbb1bea24c3277a26b5a887
6
+ metadata.gz: 220bc20b778767ec025b5402e7f0fb5a32c2cd15b37373e26af20d5de11529a75b79c745fc9e062b5e27d0bf2c62e0438806aad79950498badebc5f980562825
7
+ data.tar.gz: 375223a38b2016acb6d3bf9f45a01b6e286b95b32dcd2ab39fa2f90e4d1758bc12e3409333b9370a1b4c653c0ee6d6e5d1249891d93fbff159e5d8d2ad2dcf66
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.57)
4
+ ree_lib (1.0.58)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -26,8 +26,8 @@ module ReeDao
26
26
  load_association(assoc_type, assoc_name, **opts, &block)
27
27
  end
28
28
 
29
- def handle_field(assoc_name, proc)
30
- proc.call
29
+ def handle_field(field_proc)
30
+ field_proc.call
31
31
  end
32
32
 
33
33
  contract(
@@ -109,13 +109,24 @@ module ReeDao
109
109
  **global_opts
110
110
  ).instance_exec(assoc_list, &block)
111
111
  else
112
- ReeDao::Associations.new(
112
+ threads = ReeDao::Associations.new(
113
113
  parent.agg_caller,
114
114
  assoc_list,
115
115
  parent.local_vars,
116
116
  autoload_children,
117
117
  **global_opts
118
- ).instance_exec(assoc_list, &block)[:association_threads].map(&:join)
118
+ ).instance_exec(assoc_list, &block)
119
+ threads[:association_threads].map do |association, assoc_type, assoc_name, opts, block|
120
+ Thread.new do
121
+ association.load(assoc_type, assoc_name, **opts, &block)
122
+ end
123
+ end.map(&:join)
124
+
125
+ threads[:field_threads].map do |association, field_proc|
126
+ Thread.new do
127
+ association.handle_field(field_proc)
128
+ end
129
+ end.map(&:join)
119
130
  end
120
131
  end
121
132
 
@@ -97,17 +97,18 @@ module ReeDao
97
97
  association = Association.new(self, list, **global_opts)
98
98
 
99
99
  if assoc_type == :field
100
+ field_proc = opts
100
101
  {
101
102
  association_threads: @assoc_threads,
102
- field_threads: @field_threads << Thread.new do
103
- association.handle_field(assoc_name, opts)
104
- end
103
+ field_threads: @field_threads << [
104
+ association, field_proc
105
+ ]
105
106
  }
106
107
  else
107
108
  {
108
- association_threads: @assoc_threads << Thread.new do
109
- association.load(assoc_type, assoc_name, **get_assoc_opts(opts), &block)
110
- end,
109
+ association_threads: @assoc_threads << [
110
+ association, assoc_type, assoc_name, get_assoc_opts(opts), block
111
+ ],
111
112
  field_threads: @field_threads
112
113
  }
113
114
  end
@@ -68,8 +68,17 @@ class ReeDao::LoadAgg
68
68
  if ReeDao.load_sync_associations_enabled?
69
69
  associations
70
70
  else
71
- associations[:association_threads].map(&:join)
72
- associations[:field_threads].map(&:join)
71
+ associations[:association_threads].map do |association, assoc_type, assoc_name, opts, block|
72
+ Thread.new do
73
+ association.load(assoc_type, assoc_name, **opts, &block)
74
+ end
75
+ end.map(&:join)
76
+
77
+ associations[:field_threads].map do |association, field_proc|
78
+ Thread.new do
79
+ association.handle_field(field_proc)
80
+ end
81
+ end.map(&:join)
73
82
  end
74
83
  end
75
84
  end
@@ -275,7 +275,7 @@ RSpec.describe :load_agg do
275
275
  load_agg(users, ids_or_scope, **opts) do |agg_list|
276
276
  some_id = agg_list.first.id
277
277
  title = "1984"
278
- belongs_to :organization, organizations.by_name("Corp")
278
+ belongs_to :organization
279
279
 
280
280
  has_many :books, -> { books_opts(title) }
281
281
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.57"
4
+ VERSION = "1.0.58"
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.57
4
+ version: 1.0.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov