class Liquid::Context
- Liquid::Context
- Reference
- Object
Defined in:
liquid/context.crConstant Summary
-
FLOATS =
/^(-?\d[\d\.]+)$/
-
INTEGERS =
/^(-?\d+)$/
-
LITERALS =
Regex.union([FLOATS, INTEGERS, RANGES, STRINGS])
-
RANGES =
/^\((\S+)\.\.(\S+)\)$/
-
SquareBracketed =
/^\[(.*)\]$/
-
STRINGS =
/^['"](.*)['"]$/
Constructors
Instance Method Summary
- #[](key)
- #[]=(key : String, value : Type)
-
#[]=(key : String, value : Any)
Only allow String, Numeric, Hash, Array, Proc, Boolean or Liquid::Drop
-
#add_filters(filters : Array(Filter.class) | Filter.class)
Adds filters to this context.
- #clear_instance_assigns
- #environments : Array(Hash(String, Liquid::Type))
- #errors : Array(Exception)
- #fetch(key)
- #handle_error(e)
-
#has_interrupt?
are there any not handled interrupts?
- #has_key?(key)
- #invoke(method, *args)
-
#merge(new_scopes)
Merge a hash of variables in the current local scope
-
#pop
Pop from the stack.
-
#pop_interrupt
pop an interrupt from the stack
-
#push(new_scope = {} of String => Type)
Push new local scope on the stack.
-
#push_interrupt(e)
push an interrupt to the stack.
- #registers : Liquid::RegisterCollection
- #scopes : Array(Hash(String, Type))
-
#stack(new_scope = {} of String => Type, &)
Pushes a new local scope on the stack, pops it at the end of the block
- #strainer
- #to_liquid
Constructor Detail
Instance Method Detail
Only allow String, Numeric, Hash, Array, Proc, Boolean or Liquid::Drop
Adds filters to this context.
Note that this does not register the filters with the main Template object. see Template.register_filter for that
Push new local scope on the stack. use Context#stack instead
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