You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/context-objects.md
+49-34Lines changed: 49 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,94 +4,109 @@ Context objects are the arguments passed to APIs like [field blocks](../dsl/fiel
4
4
5
5
## Render Context
6
6
7
-
> **blueprint**\
7
+
_* Field can be assigned._
8
+
9
+
> **blueprint**\
8
10
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
9
11
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).
12
14
13
-
> **options**\
15
+
> **options** * \
14
16
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
15
17
16
-
> **depth**\
18
+
> **store**\
19
+
> A Hash that can be used to store & access information by extensions and your application.
20
+
21
+
> **depth**\
17
22
> The current blueprint depth (1-indexed).
18
23
19
24
## Object Context
20
25
21
-
> **blueprint**\
26
+
_* Field can be assigned._
27
+
28
+
> **blueprint**\
22
29
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
23
30
24
-
> **fields**\
31
+
> **fields**\
25
32
> 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.
26
33
27
-
> **options**\
34
+
> **options**\
28
35
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
29
36
30
-
> **object**\
37
+
> **object** * \
31
38
> The object or collection currently being serialized.
32
39
33
-
> **depth**\
40
+
> **store**\
41
+
> A Hash that can be used to store & access information by extensions and your application.
42
+
43
+
> **depth**\
34
44
> The current blueprint depth (1-indexed).
35
45
36
46
## Field Context
37
47
38
-
> **blueprint**\
48
+
> **blueprint**\
39
49
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
40
50
41
-
> **fields**\
51
+
> **fields**\
42
52
> 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.
43
53
44
-
> **options**\
54
+
> **options**\
45
55
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
46
56
47
-
> **object**\
57
+
> **object**\
48
58
> The object currently being serialized.
49
59
50
-
> **field**\
60
+
> **field**\
51
61
> 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).
52
62
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.
55
65
56
-
> **depth**\
66
+
> **depth**\
57
67
> The current blueprint depth (1-indexed).
58
68
59
69
## Result Context
60
70
61
-
> **blueprint**\
71
+
_* Field can be assigned._
72
+
73
+
> **blueprint** * \
62
74
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
63
75
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.
66
78
67
-
> **options**\
79
+
> **options** * \
68
80
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
69
81
70
-
> **object**\
82
+
> **object** * \
71
83
> The object or collection that was just serialized.
72
84
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.
75
87
76
-
> **depth**\
77
-
> The current blueprint depth (1-indexed).
88
+
> **format** * \
89
+
> The requested serialization format (e.g. `:json`, `:hash`).
78
90
79
91
## Hook Context
80
92
81
-
> **blueprint**\
93
+
> **blueprint**\
82
94
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
83
95
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.
86
98
87
-
> **options**\
99
+
> **options**\
88
100
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
89
101
90
-
> **extension**\
102
+
> **extension**\
91
103
> Instance of the current extension
92
104
93
-
> **hook**\
105
+
> **hook**\
94
106
> Name of the current hook
95
107
96
-
> **depth**\
108
+
> **store**\
109
+
> A Hash that can be used to store & access information by extensions and your application.
0 commit comments