Module: Whoosh::Streaming::Helpers
Instance Method Summary collapse
Instance Method Details
#stream(type, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/whoosh/streaming/helpers.rb', line 6 def stream(type, &block) case type when :sse body = StreamBody.new do |out| sse = SSE.new(out) block.call(sse) end [200, SSE.headers, body] else raise ArgumentError, "Unknown stream type: #{type}" end end |