KbEnvironmentBuilder

DSL receiver passed to the configure lambda of KbEnvironment.create for registering transforms and properties on the environment under construction.

Built-in transforms (upcase, downcase, …) and the default properties (such as now) are pre-registered before the lambda runs.

This class is not designed for external subclassing; the constructor is internal to preserve binary compatibility as new methods are added.

Functions

Link copied to clipboard
abstract fun addProperty(name: String, property: KbTransformable)

Registers a new environment property under name. Throws if name is already registered (including defaults such as now). Use overrideProperty to replace an existing registration.

Link copied to clipboard
abstract fun addTransform(name: String, transform: KbTransform)

Registers a new transform under name. Throws if name is already registered (including built-ins). Use overrideTransform to replace an existing registration.

Link copied to clipboard
abstract fun eventListener(listener: KbEventListener)

Registers listener to observe soft failures during renders that use the resulting environment. Registering a listener is optional; the default is no listener. The most recent registration wins.

Link copied to clipboard
abstract fun maxPartialDepth(depth: Int)

Sets the maximum nesting depth of partial renders before recursion is treated as runaway and soft-fails, emitting nothing for the over-deep partial. Defaults to 64.

Link copied to clipboard
abstract fun onLoadPartial(loader: KbPartialLoader)

Registers loader to resolve {{> key }} partials during renders that use the resulting environment. Registering a loader is optional; the default is no loader. The most recent registration wins.

Link copied to clipboard
abstract fun overrideProperty(name: String, property: KbTransformable)

Registers property under name, replacing any existing registration. Acts as addProperty when name is not yet registered.

Link copied to clipboard
abstract fun overrideTransform(name: String, transform: KbTransform)

Registers transform under name, replacing any existing registration. Acts as addTransform when name is not yet registered.

Link copied to clipboard
abstract fun removeProperty(name: String)

Removes the environment property registered under name. Silently does nothing when name is not registered.

Link copied to clipboard
abstract fun removeTransform(name: String)

Removes the transform registered under name. Silently does nothing when name is not registered.