Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Context Objects

Context objects are the arguments passed to APIs like field blocks, option procs and extension hooks. There are several kinds of context objects, each with its own set of fields.

Render Context

* Field can be assigned.

blueprint
The current Blueprint instance. You can use this to access the Blueprint’s name, options, reflections, and instance methods.

fields *
A frozen array of field definitions that will be serialized, in order. See Fields API.

options *
The frozen options Hash passed to render. An empty Hash if none was passed.

store
A Hash that can be used to store & access information by extensions and your application.

depth
The current blueprint depth (1-indexed).

Object Context

* Field can be assigned.

blueprint
The current Blueprint instance. You can use this to access the Blueprint’s name, options, reflections, and instance methods.

fields
A frozen array of field definitions that will be serialized, in order. See Fields API and the blueprint_fields hook.

options
The frozen options Hash passed to render. An empty Hash if none was passed.

object *
The object or collection currently being serialized.

store
A Hash that can be used to store & access information by extensions and your application.

depth
The current blueprint depth (1-indexed).

Field Context

blueprint
The current Blueprint instance. You can use this to access the Blueprint’s name, options, reflections, and instance methods.

fields
A frozen array of field definitions that will be serialized, in order. See Fields API and the blueprint_fields hook.

options
The frozen options Hash passed to render. An empty Hash if none was passed.

object
The object currently being serialized.

field
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.

store
A Hash that can be used to store & access information by extensions and your application.

depth
The current blueprint depth (1-indexed).

Result Context

* Field can be assigned.

blueprint *
The current Blueprint instance. You can use this to access the Blueprint’s name, options, reflections, and instance methods.

fields
A frozen array of field definitions that were serialized, in order. See Fields API and the around_blueprint_init hook.

options *
The frozen options Hash passed to render. An empty Hash if none was passed.

object *
The object or collection that was just serialized.

store
A Hash that can be used to store & access information by extensions and your application.

format *
The requested serialization format (e.g. :json, :hash).

Hook Context

blueprint
The current Blueprint instance. You can use this to access the Blueprint’s name, options, reflections, and instance methods.

fields
A frozen array of field definitions that will be serialized, in order. See Fields API and the around_blueprint_init hook.

options
The frozen options Hash passed to render. An empty Hash if none was passed.

extension
Instance of the current extension

hook
Name of the current hook

store
A Hash that can be used to store & access information by extensions and your application.

depth
The current blueprint depth (1-indexed).