jsonapi-serializers 2.0.0.pre.beta.1 → 2.0.0.pre.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi-serializers/serializer.rb +14 -6
- data/lib/jsonapi-serializers/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc0624eff93ecfb4e1b59488acab0da9ef639ee6eb7492ea505dd267b3a36f54
|
4
|
+
data.tar.gz: 7d4fd166a854570e74693b641e1a01aba7bd66df3fed17bd7879e8e6a21119f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 932fb952443eb58d8828f739f9b20090acbbb33a0aae4a45feef5e59d116febff63abc8fae9534c895f731978d1a55f17c7e2e7d35c28f1e52c71c8a43d630ad
|
7
|
+
data.tar.gz: 67d64725bf7f960f45070dfe4d76cdd81667ed103fbe3e483370ff23b33e86797796e1853b927a6de73c686a67da2fa83f186b35d84babc7036646c20f49717b
|
@@ -236,17 +236,25 @@ module JSONAPI
|
|
236
236
|
|
237
237
|
def self.find_serializer_class_name(object, options)
|
238
238
|
if options[:namespace]
|
239
|
-
|
239
|
+
"#{options[:namespace]}::#{object.class.name}Serializer"
|
240
|
+
else
|
241
|
+
"#{object.class.name}Serializer"
|
240
242
|
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def self.find_serializer_class(object, options)
|
241
246
|
if object.respond_to?(:jsonapi_serializer_class_name)
|
242
|
-
|
247
|
+
object.jsonapi_serializer_class_name.to_s.constantize
|
248
|
+
else
|
249
|
+
memoized_serializer_classes[object.class][options[:namespace]] ||=
|
250
|
+
find_serializer_class_name(object, options).constantize
|
243
251
|
end
|
244
|
-
"#{object.class.name}Serializer"
|
245
252
|
end
|
246
253
|
|
247
|
-
def self.
|
248
|
-
|
249
|
-
|
254
|
+
def self.memoized_serializer_classes
|
255
|
+
@memoized_serializer_classes ||= {}.tap do |hash|
|
256
|
+
hash.default_proc = ->(hash, key) { hash[key] = {} }
|
257
|
+
end
|
250
258
|
end
|
251
259
|
|
252
260
|
def self.find_serializer(object, options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.beta.
|
4
|
+
version: 2.0.0.pre.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Fotinakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: 1.3.1
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.0.
|
153
|
+
rubygems_version: 3.0.2
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Pure Ruby readonly serializers for the JSON:API spec.
|