Class: Tipsy::Server
- Inherits:
-
Object
- Object
- Tipsy::Server
- Defined in:
- lib/tipsy/server.rb
Overview
Rack server implementation. Tipsy::Server will run any Rack::Builder compatable format. If thin or mongrel are availble, they will be used first, and in that order, with a fallback to webrick.
Defined Under Namespace
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
-
.run!(app, options) ⇒ Object
Run the Rack::Builder application.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
43 44 45 |
# File 'lib/tipsy/server.rb', line 43 def initialize @last_update = Time.now end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/tipsy/server.rb', line 11 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
11 12 13 |
# File 'lib/tipsy/server.rb', line 11 def response @response end |
Class Method Details
.run!(app, options) ⇒ Object
Run the Rack::Builder application
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tipsy/server.rb', line 18 def run!(app, ) begin handler = Rack::Handler.get('thin') handler.run app, do |server| puts "Running Tipsy with Thin (#{Thin::VERSION::STRING})." end exit(0) rescue LoadError begin handler = Rack::Handler.get('mongrel') handler.run app, do |server| puts "Running Tipsy with Mongrel (#{Mongrel::Const::MONGREL_VERSION})." end exit(0) rescue LoadError handler = Rack::Handler.get('webrick') handler.run app, do |server| puts "Running Tipsy with Webrick. To use Mongrel or Thin (recommended), add them to your Gemfile" trap("INT"){ server.shutdown } end end end end |