active_record_to_hash 1.0.0 → 1.1.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 -1
- data/lib/active_record_to_hash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58db5d3bc83a1c3d5aeacc76b93c4a74170cd56f4ccce73a7c2fbda1c231bad
|
4
|
+
data.tar.gz: a386699d79c74de0ea5a1f6446544ac90a61c56b355abff1bb17b40c1f1a1f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9131d35e459532105d66f8144d73c152a6f0a66f1f1e366ddfdbacd34b6ee223c1b6457ce03682be00323db915ed09eadabda846ad5056c7aaac61b0e8e1dfca
|
7
|
+
data.tar.gz: 5ca180e0781e2bad5bfc98a697394ee44d6c9ab87a8222e81bc25041810af1df57cd291962a9f3529edee7ae3c8c63e92e17ca6ff27c2654f7699d5a5defc06d
|
@@ -20,7 +20,11 @@ module ActiveRecordToHash
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def retrieve_child_attribute(record, attr_name, options, callee) # rubocop:disable Metrics/AbcSize
|
23
|
-
|
23
|
+
if options[:value]
|
24
|
+
return options[:value].call(record) if options[:value].is_a? Proc
|
25
|
+
|
26
|
+
return options[:value]
|
27
|
+
end
|
24
28
|
|
25
29
|
args = options[:args] || []
|
26
30
|
value = record.public_send(attr_name, *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.1.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: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|