An object that provides an encapsulation of the template’s state while it is rendering.
- block R
The block passed to the template’s render method, if there was one
- containerstate R
Inversion::RenderStateof the containing template, if any
- default_errhandler R
The default error handler
- destinations R
The stack of rendered output destinations, most-recent last.
- errhandler R
The callable object that handles exceptions raised when a node is appended
- fragments R
Fragment nodes, keyed by fragment name
- options R
The config options passed in from the template
- published_nodes R
Published nodes, keyed by subscription
- start_time R
The Time the object was created
- subscriptions R
Subscribe placeholders for publish/subscribe
Create a new
RenderState. If the template is being rendered inside another one, the containing template’s
RenderState will be passed as the ‘containerstate`. The `initial_attributes` will be deep-copied, and the `options` will be merged with Inversion::Template::DEFAULT_CONFIG. The `block` is stored for use by template nodes.
Append operator – add an node to the final rendered output. If the ‘node` renders as an object that itself responds to the render method, render will be called and the return value will be appended instead. This will continue until the returned object either doesn’t respond to render or renders as itself.
Add one or more rendered ‘nodes` to the state as a reusable fragment associated with the specified `name`.
Backward-compatibility – return the tag locals of the current scope as a Hash.
Default exception handler: Handle an ‘exception` while rendering `node` according to the behavior specified by the `on_render_error` option. Returns the string which should be appended to the output, if any.
Return the current rendered output destination.
Disable rendering, causing rendered nodes to be discarded instead of appended.
Enable rendering, causing nodes to be appended to the rendered output.
Evaluate the specified ‘code` in the context of itself and return the result.
Handle an ‘exception` that was raised while appending a node by calling the
Return a human-readable representation of the object.
Returns a new
RenderState containing the attributes and options of the receiver merged with those of the ‘otherstate`.
Merge the attributes and options of the ‘otherstate` with those of the receiver, replacing any with the same keys.
Publish the given ‘nodes` to all subscribers to the specified `key`.
Return the current fragments Hash rendered as Strings.
Return ‘true` if rendered nodes are being saved for output.
Return the hash of attributes that are currently in effect in the rendering state.
Subscribe the given ‘node` to nodes published with the specified `key`.
Return a Hash that tags can use to track state for the current render.
Return the number of floting-point seconds that have passed since the object was created. Used to time renders.
Turn the rendered node structure into the final rendered String.
Toggle rendering, enabling it if it was disabled, and vice-versa.
Override the state’s attributes with the given ‘overrides`, call the `block`, then restore the attributes to their original values.
Override the state’s render destination, call the block, then restore the original destination when the block returns.
Set the state’s error handler to ‘handler` for the duration of the block, restoring the previous handler after the block exits. `Handler` must respond to call, and will be called with two arguments: the node that raised the exception, and the exception object itself.
Add an overlay to the current tag state Hash, yield to the provided block, then revert the tag state back to what it was prior to running the block.
Return the specified ‘content` inside of the configured comment characters.
Return the ‘node` as a comment if debugging comments are enabled.
Handle attribute methods.
Return the given ‘nodes` as a String in the configured encoding.