panko_serializer 0.7.2 → 0.7.6
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/.github/workflows/docs.yml +39 -0
- data/.github/workflows/ruby.yml +48 -0
- data/.gitignore +2 -1
- data/Gemfile +5 -14
- data/README.md +7 -7
- data/benchmarks/bm_panko_json.rb +5 -1
- data/benchmarks/setup.rb +3 -1
- data/benchmarks/type_casts/bm_panko.rb +2 -2
- data/docs/.DS_Store +0 -0
- data/docs/README.md +195 -8
- data/docs/core/Footer.js +81 -0
- data/docs/{associations.md → docs/associations.md} +7 -3
- data/docs/{attributes.md → docs/attributes.md} +8 -4
- data/docs/{design-choices.md → docs/design-choices.md} +6 -2
- data/docs/{getting-started.md → docs/getting-started.md} +5 -1
- data/docs/docs/introduction.md +13 -0
- data/docs/{performance.md → docs/performance.md} +11 -7
- data/docs/{response-bag.md → docs/response-bag.md} +24 -1
- data/docs/i18n/en.json +50 -0
- data/docs/package-lock.json +9673 -0
- data/docs/package.json +14 -0
- data/docs/sidebars.json +15 -0
- data/docs/siteConfig.js +80 -0
- data/docs/static/.DS_Store +0 -0
- data/docs/static/css/custom.css +51 -0
- data/docs/static/img/favicon.ico +0 -0
- data/docs/static/img/oss_logo.png +0 -0
- data/docs/static/img/undraw_code_review.svg +1 -0
- data/docs/static/img/undraw_monitor.svg +1 -0
- data/docs/static/img/undraw_note_list.svg +1 -0
- data/docs/static/img/undraw_online.svg +1 -0
- data/docs/static/img/undraw_open_source.svg +1 -0
- data/docs/static/img/undraw_operating_system.svg +1 -0
- data/docs/static/img/undraw_react.svg +1 -0
- data/docs/static/img/undraw_tweetstorm.svg +1 -0
- data/docs/static/img/undraw_youtube_tutorial.svg +1 -0
- data/docs/static/index.html +14 -0
- data/ext/panko_serializer/attributes_writer/active_record.c +58 -16
- data/ext/panko_serializer/attributes_writer/attributes_writer.c +8 -7
- data/ext/panko_serializer/attributes_writer/common.h +1 -1
- data/ext/panko_serializer/attributes_writer/hash.c +2 -4
- data/ext/panko_serializer/attributes_writer/plain.c +2 -3
- data/ext/panko_serializer/attributes_writer/type_cast/type_cast.c +70 -21
- data/ext/panko_serializer/attributes_writer/type_cast/type_cast.h +1 -2
- data/ext/panko_serializer/panko_serializer.c +23 -8
- data/ext/panko_serializer/serialization_descriptor/association.c +1 -0
- data/ext/panko_serializer/serialization_descriptor/attribute.c +1 -0
- data/ext/panko_serializer/serialization_descriptor/serialization_descriptor.c +7 -10
- data/lib/panko/association.rb +1 -1
- data/lib/panko/object_writer.rb +8 -0
- data/lib/panko/response.rb +5 -4
- data/lib/panko/serializer.rb +4 -2
- data/lib/panko/serializer_resolver.rb +28 -15
- data/lib/panko/version.rb +1 -1
- data/panko_serializer.gemspec +8 -7
- metadata +67 -25
- data/.travis.yml +0 -37
- data/docs/docpress.json +0 -4
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
id: response-bag
|
3
|
+
title: Response
|
4
|
+
sidebar_label: Response
|
5
|
+
---
|
2
6
|
|
3
7
|
Let's say you have some JSON payload which can is constructed using Panko serialization result,
|
4
8
|
like this:
|
@@ -33,6 +37,25 @@ end
|
|
33
37
|
|
34
38
|
And everything will work as expected!
|
35
39
|
|
40
|
+
For a single object serialization, we need to use a different API (since `Panko::Serializer` don't accept an object in it's constructor):
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
class PostsController < ApplicationController
|
44
|
+
def show
|
45
|
+
post = Post.find(params[:id])
|
46
|
+
|
47
|
+
render(
|
48
|
+
json: Panko::Response.create do |r|
|
49
|
+
{
|
50
|
+
success: true,
|
51
|
+
post: r.serializer(post, PostSerializer)
|
52
|
+
}
|
53
|
+
end
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
36
59
|
## JsonValue
|
37
60
|
|
38
61
|
Let's take the above example further, we serialized the posts and cached it as JSON string in our Cache.
|
data/docs/i18n/en.json
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"_comment": "This file is auto-generated by write-translations.js",
|
3
|
+
"localized-strings": {
|
4
|
+
"next": "Next",
|
5
|
+
"previous": "Previous",
|
6
|
+
"tagline": "High Performance JSON Serialization for ActiveRecord & Ruby Objects",
|
7
|
+
"docs": {
|
8
|
+
"associations": {
|
9
|
+
"title": "Associations",
|
10
|
+
"sidebar_label": "Associations"
|
11
|
+
},
|
12
|
+
"attributes": {
|
13
|
+
"title": "Attributes",
|
14
|
+
"sidebar_label": "Attributes"
|
15
|
+
},
|
16
|
+
"design-choices": {
|
17
|
+
"title": "Design Choices",
|
18
|
+
"sidebar_label": "Design Choices"
|
19
|
+
},
|
20
|
+
"getting-started": {
|
21
|
+
"title": "Getting Started",
|
22
|
+
"sidebar_label": "Getting Started"
|
23
|
+
},
|
24
|
+
"index": {
|
25
|
+
"title": "Introduction",
|
26
|
+
"sidebar_label": "Introduction"
|
27
|
+
},
|
28
|
+
"performance": {
|
29
|
+
"title": "Performance",
|
30
|
+
"sidebar_label": "Performance"
|
31
|
+
},
|
32
|
+
"response-bag": {
|
33
|
+
"title": "Response",
|
34
|
+
"sidebar_label": "Response"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"links": {
|
38
|
+
"Docs": "Docs"
|
39
|
+
},
|
40
|
+
"categories": {
|
41
|
+
"Panko": "Panko",
|
42
|
+
"Reference": "Reference"
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"pages-strings": {
|
46
|
+
"Help Translate|recruit community translators for your project": "Help Translate",
|
47
|
+
"Edit this Doc|recruitment message asking to edit the doc source": "Edit",
|
48
|
+
"Translate this Doc|recruitment message asking to translate the docs": "Translate"
|
49
|
+
}
|
50
|
+
}
|