Class: Appsignal::Rack::EnumerableBodyWrapper Private
- Inherits:
-
BodyWrapper
- Object
- BodyWrapper
- Appsignal::Rack::EnumerableBodyWrapper
- 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.
The standard Rack body wrapper which exposes “each” for iterating over the response body. This is supported across all 3 major Rack versions.
Direct Known Subclasses
Constant Summary
Constants inherited from BodyWrapper
Instance Method Summary collapse
- #each(&blk) ⇒ Object private
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
#each(&blk) ⇒ 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.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/appsignal/rack/body_wrapper.rb', line 96 def each(&blk) # This is a workaround for the Rails bug when there was a bit too much # eagerness in implementing to_ary, see: # https://github.com/rails/rails/pull/44953 # https://github.com/rails/rails/pull/47092 # https://github.com/rails/rails/pull/49627 # https://github.com/rails/rails/issues/49588 # While the Rack SPEC does not mandate `each` to be callable # in a blockless way it is still a good idea to have it in place. return enum_for(:each) unless block_given? Appsignal.instrument("process_response_body.rack", "Process Rack response body (#each)") do @body.each(&blk) end rescue *IGNORED_ERRORS # Do not report raise rescue Exception => error # rubocop:disable Lint/RescueException appsignal_report_error(error) raise error end |