Class: Nucleus::StreamCallback
- Inherits:
-
Object
- Object
- Nucleus::StreamCallback
- Includes:
- Logging
- Defined in:
- lib/nucleus/core/common/stream_callback.rb
Instance Attribute Summary collapse
-
#closed ⇒ Object
Returns the value of attribute closed.
Instance Method Summary collapse
-
#close ⇒ void
Close the stream.
-
#initialize(stream) ⇒ StreamCallback
constructor
A new instance of StreamCallback.
-
#send_message(message) ⇒ Object
Send a message via the stream to the client.
Methods included from Logging
configure_logger_for, #log, logger_for
Constructor Details
#initialize(stream) ⇒ StreamCallback
Returns a new instance of StreamCallback.
7 8 9 10 |
# File 'lib/nucleus/core/common/stream_callback.rb', line 7 def initialize(stream) @stream = stream @closed = false end |
Instance Attribute Details
#closed ⇒ Object
Returns the value of attribute closed.
5 6 7 |
# File 'lib/nucleus/core/common/stream_callback.rb', line 5 def closed @closed end |
Instance Method Details
#close ⇒ void
This method returns an undefined value.
Close the stream
21 22 23 24 25 |
# File 'lib/nucleus/core/common/stream_callback.rb', line 21 def close log.debug 'Close API stream, invoked by adapter callback' # close API stream of the Rack server unless it was already closed @stream.close unless @closed end |
#send_message(message) ⇒ Object
Send a message via the stream to the client
14 15 16 17 |
# File 'lib/nucleus/core/common/stream_callback.rb', line 14 def () log.debug "New streamed message part: #{}" @stream.chunk end |