Class: Massimo::Server
- Inherits:
-
Object
- Object
- Massimo::Server
- Defined in:
- lib/massimo/server.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(site = Massimo.site) ⇒ Server
constructor
A new instance of Server.
Constructor Details
Class Method Details
.start(site, port = 3000) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/massimo/server.rb', line 7 def start(site, port = 3000) handler = Rack::Handler.default trap(:INT) do if handler.respond_to?(:shutdown) handler.shutdown else exit end end handler.run(self.new(site), :Port => port) end |
Instance Method Details
#call(env) ⇒ Object
26 27 28 29 30 |
# File 'lib/massimo/server.rb', line 26 def call(env) @watcher.process env['PATH_INFO'] << 'index.html' if env['PATH_INFO'].ends_with? '/' @file_server.call(env) end |