foobara 0.0.31 → 0.0.32
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c792e842511e06c18b7104b2d417b4ba93275266f94257207176f9c6eed4265f
|
4
|
+
data.tar.gz: 4ce865c5dd74d839710bdb4a766e47e645ab07e4a484cf32ede9ed839e3d75a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d0d59e0a8bd59703873c845a06a9afb756c8326700f8858eeeff476cde1ad3b20386037008211db6878727eb6585d9d7cd4b8e4892e784d65028c9d19060db1
|
7
|
+
data.tar.gz: a45f976f9a90d78a1f6e4ae2077da4846565a89c2092a0cf7da92ab068dda6ef25b2ec1f8700824ff29c3dc58b53f4ebc0bdf35984b865c6cb91c63136327204
|
data/CHANGELOG.md
CHANGED
@@ -6,17 +6,21 @@ module Foobara
|
|
6
6
|
class EntitiesToPrimaryKeysSerializer < SuccessSerializer
|
7
7
|
def serialize(object)
|
8
8
|
case object
|
9
|
-
# What of DetachedEntity? I guess we should treat it as a model since we can't cast from primary key value to
|
10
|
-
# a record?
|
11
9
|
when Entity
|
12
10
|
# TODO: handle polymorphism? Would require iterating over the result type not the object!
|
13
11
|
# Is there maybe prior art for this in the associations stuff?
|
14
12
|
object.primary_key
|
13
|
+
when DetachedEntity
|
14
|
+
if declaration_data[:detached_to_primary_key]
|
15
|
+
object.primary_key
|
16
|
+
else
|
17
|
+
object.attributes
|
18
|
+
end
|
15
19
|
when Model
|
16
20
|
object.attributes
|
17
|
-
when Array
|
21
|
+
when ::Array
|
18
22
|
object.map { |element| serialize(element) }
|
19
|
-
when Hash
|
23
|
+
when ::Hash
|
20
24
|
object.to_h do |key, value|
|
21
25
|
[serialize(key), serialize(value)]
|
22
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara-util
|