Skip to content

Commit 7ca68b8

Browse files
committed
Update extension docs to middleware-based design
1 parent bcfe4d4 commit 7ca68b8

File tree

14 files changed

+237
-450
lines changed

14 files changed

+237
-450
lines changed

book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build-dir = "docs-dist"
1010

1111
# https://rust-lang.github.io/mdBook/format/configuration/renderers.html?highlight=top%20bar#html-renderer-options
1212
[output.html]
13-
additional-css = ["theme/hljs-overrides.css"]
13+
additional-css = ["theme/hljs-overrides.css", "theme/custom.css"]
1414
default-theme = "light"
1515
preferred-dark-theme = "navy"
1616
no-section-label = true

docs/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
- [Blueprinter API](./api/index.md)
1616
- [Extensions](./api/extensions.md)
1717
- [Reflection](./api/reflection.md)
18-
- [Extractors](./api/extractors.md)
1918
- [Context Objects](./api/context-objects.md)
2019
- [Fields](./api/fields.md)
2120

docs/api/context-objects.md

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,109 @@ Context objects are the arguments passed to APIs like [field blocks](../dsl/fiel
44

55
## Render Context
66

7-
> **blueprint**\
7+
_* Field can be assigned._
8+
9+
> **blueprint** \
810
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
911
10-
> **fields**\
11-
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
12+
> **fields** * \
13+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md).
1214
13-
> **options**\
15+
> **options** * \
1416
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
1517
16-
> **depth**\
18+
> **store** \
19+
> A Hash that can be used to store & access information by extensions and your application.
20+
21+
> **depth** \
1722
> The current blueprint depth (1-indexed).
1823
1924
## Object Context
2025

21-
> **blueprint**\
26+
_* Field can be assigned._
27+
28+
> **blueprint** \
2229
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
2330
24-
> **fields**\
31+
> **fields** \
2532
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
2633
27-
> **options**\
34+
> **options** \
2835
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
2936
30-
> **object**\
37+
> **object** * \
3138
> The object or collection currently being serialized.
3239
33-
> **depth**\
40+
> **store** \
41+
> A Hash that can be used to store & access information by extensions and your application.
42+
43+
> **depth** \
3444
> The current blueprint depth (1-indexed).
3545
3646
## Field Context
3747

38-
> **blueprint**\
48+
> **blueprint** \
3949
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
4050
41-
> **fields**\
51+
> **fields** \
4252
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
4353
44-
> **options**\
54+
> **options** \
4555
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
4656
47-
> **object**\
57+
> **object** \
4858
> The object currently being serialized.
4959
50-
> **field**\
60+
> **field** \
5161
> A struct of the field, object, or collection currently being rendered. You can use this to access the field's name and options. See [Fields API](./fields.md).
5262
53-
> **value**\
54-
> The extracted field value. (In certain situations, like the extractor API and field blocks, it will always be `nil` since nothing has been extracted yet.)
63+
> **store** \
64+
> A Hash that can be used to store & access information by extensions and your application.
5565
56-
> **depth**\
66+
> **depth** \
5767
> The current blueprint depth (1-indexed).
5868
5969
## Result Context
6070

61-
> **blueprint**\
71+
_* Field can be assigned._
72+
73+
> **blueprint** * \
6274
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
6375
64-
> **fields**\
65-
> A frozen array of field definitions that were serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
76+
> **fields** \
77+
> A frozen array of field definitions that were serialized, in order. See [Fields API](./fields.md) and the [around_blueprint_init](./extensions.md#around_blueprint_init) hook.
6678
67-
> **options**\
79+
> **options** * \
6880
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
6981
70-
> **object**\
82+
> **object** * \
7183
> The object or collection that was just serialized.
7284
73-
> **result**\
74-
> A serialized result. Depending on the situation this will be a Hash or an array of Hashes.
85+
> **store** \
86+
> A Hash that can be used to store & access information by extensions and your application.
7587
76-
> **depth**\
77-
> The current blueprint depth (1-indexed).
88+
> **format** * \
89+
> The requested serialization format (e.g. `:json`, `:hash`).
7890
7991
## Hook Context
8092

81-
> **blueprint**\
93+
> **blueprint** \
8294
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
8395
84-
> **fields**\
85-
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
96+
> **fields** \
97+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [around_blueprint_init](./extensions.md#around_blueprint_init) hook.
8698
87-
> **options**\
99+
> **options** \
88100
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
89101
90-
> **extension**\
102+
> **extension** \
91103
> Instance of the current extension
92104
93-
> **hook**\
105+
> **hook** \
94106
> Name of the current hook
95107
96-
> **depth**\
108+
> **store** \
109+
> A Hash that can be used to store & access information by extensions and your application.
110+
111+
> **depth** \
97112
> The current blueprint depth (1-indexed).

0 commit comments

Comments
 (0)