active_record_to_hash 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_to_hash/utilities.rb +5 -2
- data/lib/active_record_to_hash/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: 8d9743465360d22a33a753c3df713f8f1618125f11525f151d4f5a5a1892e077
|
4
|
+
data.tar.gz: 93d3c307feeda5b2e74e8dc62db5f1e0d469e8b17d1cd551e9447dbb8d5894c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c530d290bda6cca4a322e2562221c8063f905925224b9bcf7eae29633d716f38ab9654c564438a6d52eb520cee0d80d863290cb60440684e0f0f91f53e6698
|
7
|
+
data.tar.gz: 0a860c3d9156d17bb4dbd4375bfebeef257f7b4449a17cf94ba99b27b0f88e2b75ca45a09f52048474578c7272f0aed4d05f5359233f7f9062951964b4905cf5
|
@@ -19,7 +19,7 @@ module ActiveRecordToHash
|
|
19
19
|
[value]
|
20
20
|
end
|
21
21
|
|
22
|
-
def retrieve_child_attribute(record, attr_name, options, callee) # rubocop:disable Metrics/AbcSize
|
22
|
+
def retrieve_child_attribute(record, attr_name, options, callee) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/LineLength
|
23
23
|
if options.key?(:value)
|
24
24
|
return options[:value].call(record) if options[:value].is_a? Proc
|
25
25
|
|
@@ -30,7 +30,10 @@ module ActiveRecordToHash
|
|
30
30
|
key = options[:delegate].keys.first
|
31
31
|
value = options[:delegate].values.first
|
32
32
|
|
33
|
-
|
33
|
+
delegator = record.public_send(key)
|
34
|
+
return nil if delegator.nil?
|
35
|
+
|
36
|
+
return delegator.public_send(value)
|
34
37
|
end
|
35
38
|
|
36
39
|
args = options[:args] || []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_to_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masamoto Miyata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: '7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: database_cleaner
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|