class

Krikri::VariableSubstitutor::JinjaVarResolver

Inherits KrikriJinja::VariableResolver < Reference < Object

Supplies a renderer's variable scope to krikri-jinja one name at a time, preparing each value (recursive re-templating, undefined detection) only when an expression actually reads it. Scopes run into the thousands of entries on a real hardening role while an expression reads a handful, so converting eagerly would dominate evaluation.

Precedence matches the Crinja context this replaces: the vars magic dict wins over a real variable named "vars"; a real variable wins over the omit sentinel; anything else is left to the engine's globals and then its undefined value.

Constructors

new(raw_vars : Hash(String, JSON::Any), substitutor : VarSubstitutor, strict : Bool = false)

strict: the probe-style engine evaluations (evaluate_structured with strict: true) need a demoted unresolvable value to reach the engine as a STRICT Undefined, so consuming it (~ concat, arithmetic) raises there the way real Jinja's strict undefined does - the lenient render path must keep stringifying to "", and default()-tolerated shapes must stay tolerated (live-verified vs 2.19.11: badvar: "{{ undefined_deep }}" fails "{{ 'a' ~ badvar ~ 'b' }}" arg finalization but renders "{{ badvar | default('x') }}" fine). Without the flag the probe evaluation silently stringified the demoted value and the chain failure never surfaced.

Source

Class methods

materializing_vars?
Source
note_materializing_vars(delta : Int32) : Nil
Source

Instance methods

resolve(name : String) : KrikriJinja::AnyValue | Nil
Source