miscellany 0.1.7 → 0.1.8

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: 6e57424c3b049c0f32faf8cf0a7e0f7f85145de07dc8ac09e61b2c2c3b8dd926
4
- data.tar.gz: 52c108a746be070473df4bc9c4bad66daf216809e72dea58a628b2c94d14923d
3
+ metadata.gz: c746bac8225f832908693a4c5ec79af44fc936ea6a91457cd7b22e10d33114a4
4
+ data.tar.gz: 674c97648f5bda39bbc6a2025fdd35e103c6e0dbad56ef72a5e912dee15e6119
5
5
  SHA512:
6
- metadata.gz: e9d8ddae9f677caa1c1c689a85abefaa64beb46cac97e9005be62c68b709ebe02bfb26791344bb58ab13cf6a557024d12bd8cbe667e88097c466cacf5148b31e
7
- data.tar.gz: a8fe4f104a46d80c2af4fb0421716d34359fb0fabf35cb362b4ed33e284ee20a09054ec12fa14340127cadbf57c21e2982f6ed89459de54b7bf576eca395b501
6
+ metadata.gz: cc8bea4728c5e04209cedaedd7d16a93b3e59fcc08ae52c4bffde09dc2f06be85dc03fafff6f406c2f04078bf6f71bd773e924d687d8046f6c4597b9f1e17c6e
7
+ data.tar.gz: efb98108c92e1047d70f96bd591893119b90c6a8cb9b5b3314258063d28313c785464a16def6f1b877a480f38527f0d0f6fa1ae5029854591cb8ea19441cfad2
@@ -0,0 +1,20 @@
1
+ module Miscellany
2
+ module GoldiloadValue
3
+
4
+ def goldiload_value(key, &blk)
5
+ return goldi_values[key] if goldi_values && goldi_values.key?(key)
6
+
7
+ models = auto_include_context.models
8
+ loaded = blk.call(models)
9
+ models.each do |m|
10
+ (m.goldi_values ||= {})[key] = loaded.key?(m) ? loaded[m] : loaded[m&.id]
11
+ end
12
+
13
+ goldi_values[key]
14
+ end
15
+
16
+ def self.install
17
+ ::ActiveRecord::Base.include(GoldiloadValue)
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Miscellany
2
- VERSION = "0.1.7".freeze
2
+ VERSION = "0.1.8".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miscellany
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -115,6 +115,7 @@ files:
115
115
  - lib/miscellany/active_record/batched_destruction.rb
116
116
  - lib/miscellany/active_record/computed_columns.rb
117
117
  - lib/miscellany/active_record/custom_preloaders.rb
118
+ - lib/miscellany/active_record/goldiload_value.rb
118
119
  - lib/miscellany/batch_processor.rb
119
120
  - lib/miscellany/batching_csv_processor.rb
120
121
  - lib/miscellany/controller/http_error_handling.rb