Class: Genit::Server

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

Overview

I use WEBrick to serve the html from the root directory.

Instance Method Summary collapse

Constructor Details

#initialize(wd) ⇒ Server

Public: Constructor.

wd - The String working directory, where live the project.



13
14
15
16
# File 'lib/genit/server/server.rb', line 13

def initialize wd
  @server = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => wd)
  ['INT', 'TERM'].each {|signal| trap_this signal }
end

Instance Method Details

#startObject

Start the web server.

Returns nothing.



21
22
23
24
# File 'lib/genit/server/server.rb', line 21

def start
  puts "Press Ctrl-C to close."
  @server.start
end