Class: Roda::RodaPlugins::SSE::Output
- Inherits:
-
Object
- Object
- Roda::RodaPlugins::SSE::Output
- Defined in:
- lib/roda/plugins/sse.rb
Instance Method Summary collapse
- #<<(message) ⇒ Object
- #close(error = nil) ⇒ Object
-
#initialize(stream) ⇒ Output
constructor
A new instance of Output.
- #write(message) ⇒ Object
Constructor Details
#initialize(stream) ⇒ Output
Returns a new instance of Output.
21 22 23 |
# File 'lib/roda/plugins/sse.rb', line 21 def initialize(stream) @stream = stream end |
Instance Method Details
#<<(message) ⇒ Object
31 32 33 34 |
# File 'lib/roda/plugins/sse.rb', line 31 def <<() write() self end |
#close(error = nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/roda/plugins/sse.rb', line 36 def close(error = nil) if stream = @stream @stream = nil stream.close_write(error) end end |
#write(message) ⇒ Object
25 26 27 28 29 |
# File 'lib/roda/plugins/sse.rb', line 25 def write() data = .to_s @stream.write(data) return data.bytesize end |