Skip to content

TemplateValues

[Source]

A scoped key-value store for template rendering. Values are stored as TemplateValue entries and looked up by name. Lookups check the local scope first, then walk up the parent chain.

Use scope() to create a writable child that inherits all values from this set without copying. Use update() and unescaped() to add values.

class ref TemplateValues

Constructors

create

[Source]

new ref create()
: TemplateValues ref^

Returns


Public Functions

apply

[Source]

fun box apply(
  name: String val)
: TemplateValue box ?

Parameters

Returns


update

[Source]

Store a value under the given name. String values are wrapped in a TemplateValue automatically. This is also the target of Pony's sugar for values("key") = "value".

fun ref update(
  name: String val,
  value: (String val | TemplateValue box))
: None val

Parameters

Returns


unescaped

[Source]

Store a string value that bypasses HTML auto-escaping in HtmlTemplate. See TemplateValue.unescaped for details. For structured values (with properties or sequences), use TemplateValue.unescaped() directly and pass the result to update().

fun ref unescaped(
  name: String val,
  value: String val)
: None val

Parameters

Returns


scope

[Source]

Create an empty writable child scope backed by this value set as a read-only parent. Writes go to the child; lookups that miss in the child fall through to the parent.

fun box scope()
: TemplateValues ref

Returns