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.
49 50 51 52 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 49 def initialize(stream, transaction) @stream = stream @transaction = transaction end |
Instance Method Details
#close ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 61 def close @stream.close if @stream.respond_to?(:close) rescue Exception => e @transaction.set_error(e) raise e ensure Appsignal::Transaction.complete_current! end |
#each ⇒ Object
54 55 56 57 58 59 |
# File 'lib/appsignal/rack/streaming_listener.rb', line 54 def each @stream.each { |c| yield(c) } rescue Exception => e @transaction.set_error(e) raise e end |