Class: Rack::Handler::Thin
- Inherits:
-
Object
- Object
- Rack::Handler::Thin
- Defined in:
- lib/rack/handler/thin.rb
Class Method Summary collapse
Class Method Details
.run(app, options = {}) {|server| ... } ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/handler/thin.rb', line 11 def self.run(app, ={}) environment = ENV['RACK_ENV'] || 'development' default_host = environment == 'development' ? 'localhost' : '0.0.0.0' host = .delete(:Host) || default_host port = .delete(:Port) || 8080 args = [host, port, app, ] # Thin versions below 0.8.0 do not support additional options args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8 server = ::Thin::Server.new(*args) yield server if block_given? server.start end |
.valid_options ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/rack/handler/thin.rb', line 25 def self. environment = ENV['RACK_ENV'] || 'development' default_host = environment == 'development' ? 'localhost' : '0.0.0.0' { "Host=HOST" => "Hostname to listen on (default: #{default_host})", "Port=PORT" => "Port to listen on (default: 8080)", } end |