class

Liquid::Context

Inherits Reference / Object

Constants

FLOATS = /^(-?\d[\d\.]+)$/
INTEGERS = /^(-?\d+)$/
LITERALS = Regex.union([FLOATS, INTEGERS, RANGES, STRINGS])
RANGES = /^\((\S+)\.\.(\S+)\)$/
SquareBracketed = /^\[(.*)\]$/
STRINGS = /^['"](.*)['"]$/

Constructors

new(environments : Array(Hash(String, Liquid::Type)) = [] of Hash(String, Type), outer_scope = {} of String => Type, registers = {} of Symbol => Type, rethrow_errors : Bool = false)
Source

Instance methods

[](key)
Source
[]=(key : String, value : Type)
Source
[]=(key : String, value : Any)

Only allow String, Numeric, Hash, Array, Proc, Boolean or <tt>Liquid::Drop</tt>

Source
add_filters(filters : Array(Filter.class) | Filter.class)

Adds filters to this context.

Note that this does not register the filters with the main Template object. see <tt>Template.register_filter</tt> for that

Source
clear_instance_assigns
Source
environments
Source
errors
Source
fetch(key)
Source
handle_error(e)
Source
has_interrupt?

are there any not handled interrupts?

Source
has_key?(key)
Source
invoke(method, *args)
Source
merge(new_scopes)

Merge a hash of variables in the current local scope

Source
pop

Pop from the stack. use <tt>Context#stack</tt> instead

Source
pop_interrupt

pop an interrupt from the stack

Source
push(new_scope = {} of String => Type)

Push new local scope on the stack. use <tt>Context#stack</tt> instead

Source
push_interrupt(e)

push an interrupt to the stack. this interrupt is considered not handled.

Source
registers
Source
scopes
Source
stack(new_scope = {} of String => Type, &)

Pushes a new local scope on the stack, pops it at the end of the block

Example: context.stack do context["var"] = "hi" end

context["var] #=> nil

Source
strainer
Source
to_liquid
Source