lib/roda/plugins/streaming.rb
# Immediately return a streaming response using the current response
# status and headers, calling the block to get the streaming response.
# See Streaming for details.
Immediately return a streaming response using the current response
status and headers, calling the block to get the streaming response.
See Streaming for details.
Immediately return a streaming response using the current response status and headers calling the block to get the streaming response . See Streaming for details .
def stream(opts=OPTS, &block)
          if opts[:loop]
            block = proc do |out|
              until out.closed?
                begin
                  yield(out)
                rescue => e
                  handle_stream_error(e, out)
                end
              end
            end
          end
          stream_class = (opts[:async] && RUBY_VERSION >= '2.3') ? AsyncStream : Stream
          throw :halt, @_response.finish_with_body(stream_class.new(opts, &block))
        end
def stream ( opts = OPTS , & block ) if opts [ :loop ] block = proc do | out | until out . closed? begin yield ( out ) rescue => e handle_stream_error ( e , out ) end end end end stream_class = ( opts [ :async ] && RUBY_VERSION >= '2.3' ) ? AsyncStream : Stream throw :halt , @_response . finish_with_body ( stream_class . new ( opts , & block ) ) end
Immediately return a streaming response using the current response
status and headers, calling the block to get the streaming response.
Immediately return a streaming response using the current response status and headers calling the block to get the streaming response .
opts
block