transmutation 0.6.0 → 0.6.1
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/transmutation/serialization/rendering.rb +19 -4
- data/lib/transmutation/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: 84b0d0743fade5189b104186c820f4e26cbe080e9d11a4897571bd8ddb385eb9
|
|
4
|
+
data.tar.gz: 6e840a6211c0d8a323f3e0881722982c5de597a3234f77546ecd2161db9f159e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36a016fa29e03c5bdd297bd162ad0c4d059b33ae0c723ea55bb97fd91450bcb5bf8c9f589cad9754a5cdf96ec794ed283f73530f5c6c1baad6022762458464f4
|
|
7
|
+
data.tar.gz: e34f4863e99f1f60279a3bde9635c70a483d7488bc8238137da482c52fb9df86522d5c0b6dc7ed75f7ca70fd251182e553c055b4edf5e9c6e964128efb36bdfd
|
|
@@ -4,11 +4,26 @@ module Transmutation
|
|
|
4
4
|
module Serialization
|
|
5
5
|
module Rendering
|
|
6
6
|
# Serializes the value of the `json` parameter before calling the existing render method.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
#
|
|
8
|
+
# Handles both Rails-style hash arguments (e.g., from send_data) and keyword arguments.
|
|
9
|
+
def render(options = nil, **kwargs)
|
|
10
|
+
# Handle Rails-style positional hash argument (e.g., from send_data calling render(body: data))
|
|
11
|
+
if options.is_a?(Hash)
|
|
12
|
+
return super(options) unless options.key?(:json)
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
kwargs = options.merge(kwargs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
json = kwargs.delete(:json)
|
|
18
|
+
should_serialize = kwargs.key?(:serialize) ? kwargs.delete(:serialize) : true
|
|
19
|
+
namespace = kwargs.delete(:namespace)
|
|
20
|
+
serializer = kwargs.delete(:serializer)
|
|
21
|
+
max_depth = kwargs.delete(:max_depth) || Transmutation.max_depth
|
|
22
|
+
|
|
23
|
+
return super(**kwargs) unless json
|
|
24
|
+
return super(**kwargs, json:) unless should_serialize
|
|
25
|
+
|
|
26
|
+
super(**kwargs, json: serialize(json, namespace:, serializer:, max_depth:))
|
|
12
27
|
end
|
|
13
28
|
end
|
|
14
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: transmutation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nitemaeric
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-04-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|