class

KrikriJinja::Context

Inherits Reference < Object

Constructors

new(globals : Hash(String, AnyValue) = {} of String => AnyValue, loader : Loader | Nil = nil, autoescape : Bool = false, undefined : Undefined = Undefined.new, filters : Hash(String, FilterFn) = BUILTIN_FILTERS.dup, tests : Hash(String, TestFn) = BUILTIN_TESTS.dup, rwlock : Sync::RWLock | Nil = nil)
Source

Instance methods

[](name : String) : AnyValue
Source
[]=(name : String, value : AnyValue)
Source
[]?(name : String) : AnyValue | Nil
Source
autoescape
Source
autoescape=(autoescape : Bool)
Source
blocks
Source
blocks=(blocks : Hash(String, Array(Nodes::BlockNode)))
Source
delete(name : String)
Source
filter(name : String) : FilterFn | Nil

A fully-qualified collection name (ansible.builtin.ternary, namespace.collection.name) resolves to the filter or test registered under its trailing segment, the way Ansible resolves | ansible.builtin.ternary(...) to ternary. A single dot is not a collection name (x | first.to_s stays unknown, as in jinja).

Source
filters
Source
globals
Source
has_key?(name : String) : Bool
Source
hide_from
Source
hide_from=(hide_from : Int32)
Source
hide_locals
Source
hide_locals=(hide_locals : Bool)
Source
hide_loop_var
Source
hide_loop_var=(hide_loop_var : Bool)
Source
hide_super
Source
hide_super=(hide_super : Bool)
Source
host_context

Opaque caller-supplied context handed to registered filters, tests, and functions, for hosts that need controller-side state (variable scope, role paths, plugin runners) that the engine cannot know about.

Source
host_context=(host_context : HostContext | Nil)

Opaque caller-supplied context handed to registered filters, tests, and functions, for hosts that need controller-side state (variable scope, role paths, plugin runners) that the engine cannot know about.

Source
loader
Source
loop_is_local
Source
loop_is_local=(loop_is_local : Bool)
Source
missing_attribute(obj : AnyValue, name : String) : AnyValue

An undefined for an attribute or key name that obj lacks, with Jinja's own message ("'dict object' has no attribute 'x'").

Source
pop_scope
Source
push_scope(local = false)
Source
register_block(name : String, node : Nodes::BlockNode)
Source
resolver

Lazy variable source consulted after every scope and before globals.

Source
resolver=(resolver : VariableResolver | Nil)

Lazy variable source consulted after every scope and before globals.

Source
rwlock

Shared with the owning Engine (see Engine#rwlock): @globals/@filters/ @tests below are the same Hash instances the engine mutates via register_*, so reads here must take the same lock the engine's writes take, not a private one.

Source
scopes
Source
test(name : String) : TestFn | Nil
Source
tests
Source
undefined
Source
undefined=(undefined : Undefined)
Source
undefined_any

Pre-boxed shared undefined for this context, reused on name misses.

Source
undefined_named(name : String, hint : String | Nil = nil) : AnyValue

The engine's shared Undefined instance carries no name; a lookup miss hands out a copy tagged with the variable that was missing so error messages can name it the way real Jinja2 does. Hintless misses for the same name are memoized: repeated misses (optional vars, defined checks, loop.parent) would otherwise allocate on every lookup.

Source