Module: Rack::Handler::Puma

### Home Classes Methods

### In Files

- lib/rack/handler/puma.rb

### Methods

- ::run
- ::valid_options

### Files

- Manifest.txt

### Class/Module Index

Quicksearch

- Puma
- Puma::App
- Puma::App::Status
- Puma::Binder
- Puma::CLI
- Puma::Client
- Puma::Cluster
- Puma::Cluster::Worker
- Puma::CommonLogger
- Puma::ConfigDefault
- Puma::Configuration
- Puma::Configuration::ConfigMiddleware
- Puma::ConnectionError
- Puma::Const
- Puma::ControlCLI
- Puma::DSL
- Puma::Delegation
- Puma::Events
- Puma::Events::DefaultFormatter
- Puma::Events::PidFormatter
- Puma::IOBuffer
- Puma::JRubyRestart
- Puma::JavaIOBuffer
- Puma::MiniSSL
- Puma::MiniSSL::Context
- Puma::MiniSSL::SSLError
- Puma::MiniSSL::Server
- Puma::MiniSSL::Socket
- Puma::NullIO
- Puma::Rack
- Puma::Rack::Builder
- Puma::Rack::Options
- Puma::Rack::URLMap
- Puma::Reactor
- Puma::Runner
- Puma::Server
- Puma::Single
- Puma::TCPLogger
- Puma::ThreadPool
- Puma::ThreadPool::AutoTrim
- Puma::ThreadPool::Reaper
- Puma::UnsupportedOption
- Puma::Util
- Puma::Util::HeaderHash
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLServer
- Rack
- Rack::Handler
- Rack::Handler::Puma
- IO
- IO::WaitReadable
- Object
- Process
- String

No matching classes.

# Rack::Handler::Puma

### Constants

DEFAULT_OPTIONS

### Public Class Methods

run(app, options = {}) click to toggle source

    # File lib/rack/handler/puma.rb, line 14
    def self.run(app, options = {})
      options  = DEFAULT_OPTIONS.merge(options)

      if options[:Verbose]
        app = Rack::CommonLogger.new(app, STDOUT)
      end

      if options[:environment]
        ENV['RACK_ENV'] = options[:environment].to_s
      end

      server   = ::Puma::Server.new(app)
      min, max = options[:Threads].split(':', 2)

      puts "Puma #{::Puma::Const::PUMA_VERSION} starting..."
      puts "* Min threads: #{min}, max threads: #{max}"
      puts "* Environment: #{ENV['RACK_ENV']}"
      puts "* Listening on tcp://#{options[:Host]}:#{options[:Port]}"

      server.add_tcp_listener options[:Host], options[:Port]
      server.min_threads = min
      server.max_threads = max
      yield server if block_given?

      begin
        server.run.join
      rescue Interrupt
        puts "* Gracefully stopping, waiting for requests to finish"
        server.stop(true)
        puts "* Goodbye!"
      end

    end

valid_options() click to toggle source

    # File lib/rack/handler/puma.rb, line 48
    def self.valid_options
      {
        "Host=HOST"       => "Hostname to listen on (default: localhost)",
        "Port=PORT"       => "Port to listen on (default: 8080)",
        "Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
        "Quiet"           => "Don't report each request"
      }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.