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
-
#body
Returns the complete body as a string.
- #each(&block)
- #log_error(error) private
Constructor Details
.new(&start) ⇒ Body
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 13
def initialize(&start) @start = start end
Instance Method Details
#body
Returns the complete body as a string.
#each(&block)
[ GitHub ]# 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
#log_error(error) (private)
[ GitHub ]# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 35
def log_error(error) if ActiveSupport.error_reporter ActiveSupport.error_reporter.report(error) elsif logger = ActionView::Base.logger = +"\n#{error.class} (#{error.}):\n" << error.annotated_source_code.to_s if error.respond_to?(:annotated_source_code) << " " << error.backtrace.join("\n ") logger.fatal("#{}\n\n") end end