Class: Appsignal::StreamWrapper
- Defined in:
- lib/appsignal/rack/streaming_listener.rb
Instance Method Summary collapse
- #close ⇒ Object
- #each ⇒ Object
-
#initialize(stream, transaction) ⇒ StreamWrapper
constructor
A new instance of StreamWrapper.
Constructor Details
#initialize(stream, transaction) ⇒ StreamWrapper
Returns a new instance of StreamWrapper.
54 55 56 57 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 54 def initialize(stream, transaction) @stream = stream @transaction = transaction end |
Instance Method Details
#close ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 66 def close @stream.close if @stream.respond_to?(:close) rescue Exception => e # rubocop:disable Lint/RescueException @transaction.set_error(e) raise e ensure Appsignal::Transaction.complete_current! end |
#each ⇒ Object
59 60 61 62 63 64 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 59 def each @stream.each { |c| yield(c) } rescue Exception => e # rubocop:disable Lint/RescueException @transaction.set_error(e) raise e end |