Class: ActionView::StreamingTemplateRenderer::Body
- Defined in:
- actionview/lib/action_view/renderer/streaming_template_renderer.rb
Overview
A valid Rack::Body (i.e. it responds to each). It is initialized with a block that, when called, starts rendering the template.
Instance Method Summary collapse
-
#body ⇒ Object
Returns the complete body as a string.
- #each(&block) ⇒ Object
-
#initialize(&start) ⇒ Body
constructor
:nodoc:.
Constructor Details
#initialize(&start) ⇒ Body
:nodoc:
13 14 15 |
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 13 def initialize(&start) @start = start end |
Instance Method Details
#body ⇒ Object
Returns the complete body as a string.
28 29 30 31 32 |
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 28 def body buffer = String.new each { |part| buffer << part } buffer end |
#each(&block) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 17 def each(&block) begin @start.call(block) rescue => error log_error(error) block.call ActionView::Base.streaming_completion_on_exception end self end |