Class: ActionView::StreamingTemplateRenderer
- Inherits:
-
TemplateRenderer
- Object
- AbstractRenderer
- TemplateRenderer
- ActionView::StreamingTemplateRenderer
- Defined in:
- lib/action_view/renderer/streaming_template_renderer.rb
Overview
TODO
-
Support streaming from child templates, partials and so on.
-
Rack::Cache needs to support streaming bodies
Defined Under Namespace
Classes: Body
Instance Method Summary collapse
-
#render_template(template, layout_name = nil, locals = {}) ⇒ Object
For streaming, instead of rendering a given a template, we return a Body object that responds to each.
Methods inherited from TemplateRenderer
Methods inherited from AbstractRenderer
Constructor Details
This class inherits a constructor from ActionView::AbstractRenderer
Instance Method Details
#render_template(template, layout_name = nil, locals = {}) ⇒ Object
For streaming, instead of rendering a given a template, we return a Body object that responds to each. This object is initialized with a block that knows how to render the template.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/action_view/renderer/streaming_template_renderer.rb', line 46 def render_template(template, layout_name = nil, locals = {}) #:nodoc: return [super] unless layout_name && template.supports_streaming? locals ||= {} layout = layout_name && find_layout(layout_name, locals.keys, [formats.first]) Body.new do |buffer| delayed_render(buffer, template, layout, @view, locals) end end |