Class: Boxlet::Handlers::Thin
- Inherits:
-
Object
- Object
- Boxlet::Handlers::Thin
- Defined in:
- lib/handlers/thin.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(app, params = {}) ⇒ Thin
constructor
A new instance of Thin.
- #start {|server| ... } ⇒ Object
Constructor Details
#initialize(app, params = {}) ⇒ Thin
Returns a new instance of Thin.
11 12 13 14 15 |
# File 'lib/handlers/thin.rb', line 11 def initialize(app, params={}) @app = app @params = params # super end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
9 10 11 |
# File 'lib/handlers/thin.rb', line 9 def app @app end |
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/handlers/thin.rb', line 9 def params @params end |
Instance Method Details
#start {|server| ... } ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/handlers/thin.rb', line 18 def start # environment = ENV['RACK_ENV'] || 'development' # default_host = environment == 'development' ? : '0.0.0.0' host = @params.delete(:Host) || 'localhost' port = @params.delete(:Port) || 8077 args = [host, port, @app, @params] # 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? if @params[:daemonize] == true server.pid_file = @params[:pid_file] server.log_file = @params[:log_file] server.daemonize end server.start end |