class Marten::Template::Context
- Marten::Template::Context
- Reference
- Object
Overview
A template context.
Defined in:
marten/template/context.crmarten/template/context/block_stack.cr
Constructors
- 
        .new(values : Hash(String, Value))
        
          Allows to initialize a new context from the specified values. 
- 
        .new
        
          Allows to initialize an empty context. 
Class Method Summary
- 
        .from(values : Context | Hash | NamedTuple | Nil, request : HTTP::Request)
        
          Initializes a context from a hash (or a named tuple) and an HTTP request. 
- 
        .from(values : Context | Hash | NamedTuple | Nil)
        
          Initializes a context from a hash or a named tuple. 
Instance Method Summary
- 
        #[](key : String) : Value
        
          Returns a specific context value for a given key. 
- 
        #[]=(key : String, value : Value)
        
          Allows to add a new value into the context. 
- 
        #[]=(key : String, value)
        
          Allows to add a new value into the context. 
- 
        #[]?(key : String) : Value | Nil
        
          Returns a specific context value for a given key or nilif not found.
- 
        #blocks : Marten::Template::Context::BlockStack
        
          Returns the blocks stack associated with the context. 
- 
        #empty?
        
          Returns trueif the context is empty.
- 
        #stack(&) : Nil
        
          Stack another context hash and yields itself. 
Constructor Detail
Allows to initialize a new context from the specified values.
Class Method Detail
Initializes a context from a hash (or a named tuple) and an HTTP request.
Initializes a context from a hash or a named tuple.
Instance Method Detail
Returns a specific context value for a given key or nil if not found.
Returns the blocks stack associated with the context.