Class: WhiteCastle

Inherits:
Object
  • Object
show all
Defined in:
lib/white_castle.rb

Class Method Summary collapse

Class Method Details

.start(options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/white_castle.rb', line 19

def self.start(options)

  default_options = {:port => 3000, :document_root => "."}
  options         = default_options.merge(options)
  
  server = WEBrick::HTTPServer.new(
    :Port           => options[:port],
    :DocumentRoot   => options[:document_root],
    :FancyIndexing  =>    true
  )
  server.mount '/nocache', NonCachingFileHandler
  trap('INT') { server.stop }
  server.start
end