Class: ActionView::StreamingTemplateRenderer::Body
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
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.
Class Method Summary
- .new(&start) ⇒ Body constructor
Instance Method Summary
- #each(&block)
-
#log_error(exception)
private
This is the same logging logic as in ShowExceptions middleware.
Constructor Details
.new(&start) ⇒ Body
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 14
def initialize(&start) @start = start end
Instance Method Details
#each(&block)
[ GitHub ]# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 18
def each(&block) begin @start.call(block) rescue Exception => exception log_error(exception) block.call ActionView::Base.streaming_completion_on_exception end self end
#log_error(exception) (private)
This is the same logging logic as in ShowExceptions middleware.
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 30
def log_error(exception) logger = ActionView::Base.logger return unless logger = +"\n#{exception.class} (#{exception.}):\n" << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code) << " " << exception.backtrace.join("\n ") logger.fatal("#{}\n\n") end