class Envtpl::StrictContext

Overview

Root context that resolves a missing name to Crinja::StrictUndefined.

By default a missing name resolves to the shared Crinja::Undefined, which stringifies to an empty string: a typo then produces an empty config value and exits 0. StrictUndefined raises instead — but only when printed, so default() and is defined keep working, both inspecting the undefined value without ever rendering it. That is also Jinja2's semantics.

The shared Crinja::Undefined carries no name, hence the re-wrapping here: it is the only place where the name being looked up is still known, and it is what makes the error message say which variable is missing.

Defined in:

envtpl.cr

Instance Method Summary

Instance Method Detail

def [](key : String) #

[View source]