Class: Appsignal::Rack::ArrayableBodyWrapper Private
- Inherits:
-
EnumerableBodyWrapper
- Object
- BodyWrapper
- EnumerableBodyWrapper
- Appsignal::Rack::ArrayableBodyWrapper
- Defined in:
- lib/appsignal/rack/body_wrapper.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
“to_ary” takes precedence over “each” and allows the response body to be read eagerly. If the body supports that method, it takes precedence over “each”: “Middleware may call to_ary directly on the Body and return a new Body in its place” One could “fold” both the to_ary API and the each() API into one Body object, but to_ary must also call “close” after it executes - and in the Rails implementation this pecularity was not handled properly.
Constant Summary
Constants inherited from BodyWrapper
Instance Method Summary collapse
- #to_ary ⇒ Object private
Methods inherited from EnumerableBodyWrapper
Methods inherited from BodyWrapper
#close, #initialize, #method_missing, #respond_to_missing?, wrap
Constructor Details
This class inherits a constructor from Appsignal::Rack::BodyWrapper
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Appsignal::Rack::BodyWrapper
Instance Method Details
#to_ary ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/appsignal/rack/body_wrapper.rb', line 149 def to_ary @body_already_closed = true Appsignal.instrument( "process_response_body.rack", "Process Rack response body (#to_ary)" ) do @body.to_ary end rescue *IGNORED_ERRORS # Do not report raise rescue Exception => error # rubocop:disable Lint/RescueException appsignal_report_error(error) raise error end |