Class: Rack::Handler::RaptorIO
- Inherits:
-
Object
- Object
- Rack::Handler::RaptorIO
- Defined in:
- lib/rack/handler/raptor-io.rb
Overview
Rack handler for RaptorIO::Protocol::HTTP::Server.
Class Method Summary collapse
-
.run(app, options = {}) {|@server| ... } ⇒ Object
Starts the server and runs the ‘app`.
-
.shutdown ⇒ Object
Shuts down the server.
Class Method Details
.run(app, options = {}) {|@server| ... } ⇒ Object
Starts the server and runs the ‘app`.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rack/handler/raptor-io.rb', line 15 def self.run( app, = {} ) return false if @server [:address] = .delete(:Host) || default_host [:port] ||= .delete(:Port) || 8080 @app = app @server = ::RaptorIO::Protocol::HTTP::Server.new( ) do |response| service response end yield @server if block_given? @server.run true end |
.shutdown ⇒ Object
Shuts down the server.
32 33 34 35 36 37 38 39 |
# File 'lib/rack/handler/raptor-io.rb', line 32 def self.shutdown return false if !@server @server.stop @server = nil true end |