KrikriJinja::Engine
Constructors
Instance methods
When set, {% for k, v in some_dict %} iterates the dict's (key,
value) pairs instead of failing to unpack its keys, a lenient form
some Ansible roles depend on.
When set, {% for k, v in some_dict %} iterates the dict's (key,
value) pairs instead of failing to unpack its keys, a lenient form
some Ansible roles depend on.
Evaluates an already-parsed expression. resolver supplies any
variable that variables does not define, on first use. undefined
and host_context override the engine's own for this call only, so
one engine (and its registered features) serves every caller.
Jinja's finalize: applied to every {{ }} result before it is
written out (never to values flowing between expressions).
Jinja's finalize: applied to every {{ }} result before it is
written out (never to values flowing between expressions).
Returns the parsed template for source, reusing the parse tree
across calls. Parsed nodes are shared, so evaluators must never
mutate them (see the **kwargs fix in eval_call).
Loads a template by name from the loader and renders it.
Renders an already-parsed template. resolver supplies any variable
that variables does not define, on first use.
Guards @template_cache/@expression_cache (mutated on every render/parse) and @filters/@tests/@globals (read on every render, mutated by register_*), since Crystal's Hash is not safe for concurrent access across real OS threads (-Dpreview_mt). One engine instance is commonly shared across fibers (e.g. KrikriJinja.default_engine), so this can't rely on the single-fiber-at-a-time guarantee of the default scheduler. An RWLock (not a Mutex) because filter/test/global lookups happen on every evaluation and must run concurrently with each other; only registration and cache inserts need exclusivity.
Derives an engine that hands context to every registered filter,
test, and function invoked while rendering or evaluating.