Class: Server
- Inherits:
-
WEBrick::HTTPServer
- Object
- WEBrick::HTTPServer
- Server
- Defined in:
- lib/server.rb
Defined Under Namespace
Classes: NonCachingFileHandler
Instance Method Summary collapse
-
#initialize(path, port) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(path, port) ⇒ Server
Returns a new instance of Server.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/server.rb', line 19 def initialize(path, port) @port = port @path = path mime_types = WEBrick::HTTPUtils::DefaultMimeTypes mime_types.store 'js', 'application/javascript' super( :Port => @port, :MimeTypes => mime_types ) end |
Instance Method Details
#start ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/server.rb', line 30 def start mount("/", NonCachingFileHandler, @path) t = Thread.new { super } trap("INT") { shutdown } t.join() end |