Class: WebrickServer
Instance Method Summary collapse
- #allow_termination_for_test ⇒ Object
-
#initialize(port) ⇒ WebrickServer
constructor
A new instance of WebrickServer.
- #mount(name, application) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(port) ⇒ WebrickServer
Returns a new instance of WebrickServer.
6 7 8 9 10 11 |
# File 'lib/lapillus/webrick_server.rb', line 6 def initialize(port) $stdout.sync=true $stderr.sync=true @port = port @server = WEBrick::HTTPServer.new( :Port => @port) end |
Instance Method Details
#allow_termination_for_test ⇒ Object
23 24 25 26 |
# File 'lib/lapillus/webrick_server.rb', line 23 def allow_termination_for_test Webrick::Terminate.set_server=@server @server.mount("/terminate", Webrick::Terminate) end |
#mount(name, application) ⇒ Object
19 20 21 |
# File 'lib/lapillus/webrick_server.rb', line 19 def mount(name, application) @server.mount(name, WebrickServletCGIwrapper, application) end |
#start ⇒ Object
13 14 15 16 17 |
# File 'lib/lapillus/webrick_server.rb', line 13 def start trap("INT"){ @server.shutdown } trap('TERM'){ @server.shutdown } @server.start end |