Class: Whoosh::Streaming::QueueWriter
- Inherits:
-
Object
- Object
- Whoosh::Streaming::QueueWriter
- Defined in:
- lib/whoosh/streaming/stream_body.rb
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #flush ⇒ Object
-
#initialize(queue) ⇒ QueueWriter
constructor
A new instance of QueueWriter.
- #write(data) ⇒ Object
Constructor Details
#initialize(queue) ⇒ QueueWriter
Returns a new instance of QueueWriter.
9 10 11 12 |
# File 'lib/whoosh/streaming/stream_body.rb', line 9 def initialize(queue) @queue = queue @closed = false end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/whoosh/streaming/stream_body.rb', line 23 def close @closed = true end |
#closed? ⇒ Boolean
27 28 29 |
# File 'lib/whoosh/streaming/stream_body.rb', line 27 def closed? @closed end |
#flush ⇒ Object
19 20 21 |
# File 'lib/whoosh/streaming/stream_body.rb', line 19 def flush # no-op — queue delivers immediately end |
#write(data) ⇒ Object
14 15 16 17 |
# File 'lib/whoosh/streaming/stream_body.rb', line 14 def write(data) return if @closed @queue.push(data) end |