Class: Rubrowser::Server

Inherits:
WEBrick::HTTPServer
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/server.rb

Constant Summary collapse

ROUTES =
{
  '/' => :root,
  '/data.json' => :data
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Server

Returns a new instance of Server.



19
20
21
22
23
24
25
26
# File 'lib/server.rb', line 19

def initialize(options)
  super Port: options[:port]
  @files = options[:files]

  mount_proc '/' do |req, res|
    res.body = router(req.path)
  end
end

Class Method Details

.start(options = {}) ⇒ Object



15
16
17
# File 'lib/server.rb', line 15

def self.start(options = {})
  new(options).start
end