Class: SimpleServer::Server
- Inherits:
-
Object
- Object
- SimpleServer::Server
- Defined in:
- lib/simple_server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root = Dir.pwd, port = 3000) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
- #server ⇒ Object
Constructor Details
Instance Attribute Details
#port ⇒ Object
Returns the value of attribute port.
9 10 11 |
# File 'lib/simple_server.rb', line 9 def port @port end |
#root ⇒ Object
Returns the value of attribute root.
6 7 8 |
# File 'lib/simple_server.rb', line 6 def root @root end |
Instance Method Details
#run ⇒ Object
21 22 23 24 |
# File 'lib/simple_server.rb', line 21 def run trap("INT") { server.shutdown } server.start end |
#server ⇒ Object
17 18 19 |
# File 'lib/simple_server.rb', line 17 def server @server ||= WEBrick::HTTPServer.new(:Port => port, :DocumentRoot => root) end |