active_record_compose 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active_record_compose/delegate_attribute.rb +6 -9
- data/lib/active_record_compose/inner_model.rb +1 -1
- data/lib/active_record_compose/inner_model_collection.rb +3 -3
- data/lib/active_record_compose/model.rb +2 -2
- data/lib/active_record_compose/transaction_support.rb +2 -2
- data/lib/active_record_compose/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9038b3106a9206304243a5723488fe400e6c05eba4edb69fef0e2a7a154f15f
|
4
|
+
data.tar.gz: 7432c93447a3627cf6c1e6706d6d0d3d1ea1e6d80079b9038e73fe1fd1bddaeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce874d30acf694f7be00c7177a7dcc82a49f8119709fa07b0d9cac98fc4f44ca03211bb104c8d9e2173d42ceebb0de00567c8666e1b1b6adaadd587e60d35ba
|
7
|
+
data.tar.gz: 0f3100317539f2e383ac07fed57f027c90f4030ccd2717fae2e54f288a3f17f92488fa23dc86d6cc80a05746542ef68b780c56b63dd9609ab2f27b39c21a8045
|
@@ -38,7 +38,7 @@ module ActiveRecordCompose
|
|
38
38
|
extend ActiveSupport::Concern
|
39
39
|
|
40
40
|
included do
|
41
|
-
|
41
|
+
class_attribute :delegated_attributes, instance_writer: false # steep:ignore
|
42
42
|
end
|
43
43
|
|
44
44
|
module ClassMethods
|
@@ -52,12 +52,9 @@ module ActiveRecordCompose
|
|
52
52
|
[reader, writer]
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
delegated_attributes = (self.delegated_attributes ||= [])
|
59
|
-
attributes.each { delegated_attributes.push(_1.to_s) }
|
60
|
-
end
|
55
|
+
delegate(*delegates, to:, **options) # steep:ignore
|
56
|
+
delegated_attributes = (self.delegated_attributes ||= []) # steep:ignore
|
57
|
+
attributes.each { delegated_attributes.push(_1.to_s) }
|
61
58
|
end
|
62
59
|
end
|
63
60
|
|
@@ -66,8 +63,8 @@ module ActiveRecordCompose
|
|
66
63
|
#
|
67
64
|
# @return [Hash] hash with the attribute name as key and the attribute value as value.
|
68
65
|
def attributes
|
69
|
-
attrs =
|
70
|
-
delegates =
|
66
|
+
attrs = defined?(super) ? super : {} # steep:ignore
|
67
|
+
delegates = delegated_attributes # steep:ignore
|
71
68
|
|
72
69
|
# @type var attrs: Hash[String, untyped]
|
73
70
|
# @type var delegates: Array[String]
|
@@ -76,7 +76,7 @@ module ActiveRecordCompose
|
|
76
76
|
# @return [Boolean]
|
77
77
|
def ==(other)
|
78
78
|
return false unless self.class == other.class
|
79
|
-
return false unless
|
79
|
+
return false unless __raw_model == other.__raw_model # steep:ignore
|
80
80
|
return false unless context == other.context
|
81
81
|
|
82
82
|
true
|
@@ -14,7 +14,7 @@ module ActiveRecordCompose
|
|
14
14
|
def each
|
15
15
|
return enum_for(:each) unless block_given?
|
16
16
|
|
17
|
-
|
17
|
+
models.each { yield _1.__raw_model } # steep:ignore
|
18
18
|
self
|
19
19
|
end
|
20
20
|
|
@@ -73,7 +73,7 @@ module ActiveRecordCompose
|
|
73
73
|
def __each_by_wrapped
|
74
74
|
return enum_for(:__each_by_wrapped) unless block_given?
|
75
75
|
|
76
|
-
|
76
|
+
models.each { yield _1 if _1.__raw_model } # steep:ignore
|
77
77
|
self
|
78
78
|
end
|
79
79
|
|
@@ -82,7 +82,7 @@ module ActiveRecordCompose
|
|
82
82
|
def models = @models ||= []
|
83
83
|
|
84
84
|
def wrap(model, context:)
|
85
|
-
if
|
85
|
+
if model.is_a?(ActiveRecordCompose::InnerModel) # steep:ignore
|
86
86
|
# @type var model: ActiveRecordCompose::InnerModel
|
87
87
|
model
|
88
88
|
else
|
@@ -20,7 +20,7 @@ module ActiveRecordCompose
|
|
20
20
|
validate :validate_models
|
21
21
|
|
22
22
|
def initialize(attributes = {})
|
23
|
-
|
23
|
+
super
|
24
24
|
end
|
25
25
|
|
26
26
|
# Save the models that exist in models.
|
@@ -150,7 +150,7 @@ module ActiveRecordCompose
|
|
150
150
|
|
151
151
|
def models = @__models ||= ActiveRecordCompose::InnerModelCollection.new
|
152
152
|
|
153
|
-
def wrapped_models =
|
153
|
+
def wrapped_models = models.__each_by_wrapped # steep:ignore
|
154
154
|
|
155
155
|
def validate_models = wrapped_models.select { _1.invalid? }.each { errors.merge!(_1) }
|
156
156
|
|
@@ -8,7 +8,7 @@ module ActiveRecordCompose
|
|
8
8
|
module ClassMethods
|
9
9
|
def lease_connection
|
10
10
|
if ar_class.respond_to?(:lease_connection)
|
11
|
-
|
11
|
+
ar_class.lease_connection # steep:ignore
|
12
12
|
else
|
13
13
|
ar_class.connection
|
14
14
|
end
|
@@ -16,7 +16,7 @@ module ActiveRecordCompose
|
|
16
16
|
|
17
17
|
def connection = ar_class.connection
|
18
18
|
|
19
|
-
def with_connection(&) =
|
19
|
+
def with_connection(&) = ar_class.with_connection(&) # steep:ignore
|
20
20
|
|
21
21
|
def composite_primary_key? = false
|
22
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_compose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hamajyotan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -52,7 +52,7 @@ metadata:
|
|
52
52
|
homepage_uri: https://github.com/hamajyotan/active_record_compose
|
53
53
|
source_code_uri: https://github.com/hamajyotan/active_record_compose
|
54
54
|
changelog_uri: https://github.com/hamajyotan/active_record_compose/blob/main/CHANGELOG.md
|
55
|
-
documentation_uri: https://www.rubydoc.info/gems/active_record_compose/0.3.
|
55
|
+
documentation_uri: https://www.rubydoc.info/gems/active_record_compose/0.3.3
|
56
56
|
rubygems_mfa_required: 'true'
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.5.
|
72
|
+
rubygems_version: 3.5.11
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: activemodel form object pattern
|