abstract class Marten::Template::ContextProducer
- Marten::Template::ContextProducer
- Reference
- Object
Overview
A template context producer.
Template context producers allow to contribute values to a template context, that can be optionally associated an HTTP request (if the template is rendered for a specific request for example). For example, a context producer can be used to always include the current user in the template context based on the current request, some debug information, etc.
Direct Known Subclasses
- Marten::Template::ContextProducer::Debug
- Marten::Template::ContextProducer::Flash
- Marten::Template::ContextProducer::I18n
- Marten::Template::ContextProducer::Request
Defined in:
marten/template/context_producer.crmarten/template/context_producer/debug.cr
marten/template/context_producer/flash.cr
marten/template/context_producer/i18n.cr
marten/template/context_producer/request.cr
Instance Method Summary
-
#produce(request : HTTP::Request | Nil = nil)
Returns a hash of values to include in a template context.
Instance Method Detail
Returns a hash of values to include in a template context.
The method must return a hash or named tuple if there are values to return, otherwise it can also return nil
if it can't produce any values.