class Genit::Server
I use WEBrick to serve the html from the root directory.
Public Class Methods
new(wd)
click to toggle source
Public: Constructor.
wd - The String
working directory, where live the project.
# File lib/genit/server/server.rb, line 12 def initialize wd @server = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => wd) ['INT', 'TERM'].each {|signal| trap_this signal } end
Public Instance Methods
start()
click to toggle source
Start the web server.
Returns nothing.
# File lib/genit/server/server.rb, line 20 def start puts "Press Ctrl-C to close." @server.start end
Private Instance Methods
trap_this(signal)
click to toggle source
# File lib/genit/server/server.rb, line 27 def trap_this signal trap(signal) { @server.shutdown } end