Class: WebServer

Inherits:
WEBrick::HTTPServer
  • Object
show all
Defined in:
lib/rubyfu/webserver.rb

Overview

A wrapper for WEBrick::HTTPServer class, it updates its default values

Instance Method Summary collapse

Constructor Details

#initialize(port) ⇒ WebServer

Returns a new instance of WebServer.



13
14
15
16
17
18
19
20
21
22
# File 'lib/rubyfu/webserver.rb', line 13

def initialize(port)
  bookpath = "#{File.dirname(__FILE__)}/../../_book"
  config = {:Port         => port,        # Optional
            :DocumentRoot => bookpath,  # Don't change
            :ServerName   => 'Rubyfu',    # Don't change 
            :Logger       => WEBrick::Log.new(File.open(File::NULL, 'w')),  # Disable WEBRick server logging
            :AccessLog    => []           # Disable WEBRick server access logging
            }
  super(config)                           # Update WEBrick::HTTPServer @config instance
end

Instance Method Details

#runitObject



24
25
26
27
# File 'lib/rubyfu/webserver.rb', line 24

def runit
  # Start webrick
  start
end