Class: Stack::Server
- Inherits:
-
Object
- Object
- Stack::Server
- Defined in:
- lib/stack/server.rb
Instance Attribute Summary collapse
-
#generator ⇒ Object
Returns the value of attribute generator.
-
#http_server ⇒ Object
Returns the value of attribute http_server.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
-
#thread ⇒ Object
Returns the value of attribute thread.
Instance Method Summary collapse
-
#initialize(generator) ⇒ Server
constructor
A new instance of Server.
- #observe ⇒ Object
Constructor Details
#initialize(generator) ⇒ Server
Returns a new instance of Server.
8 9 10 11 12 |
# File 'lib/stack/server.rb', line 8 def initialize(generator) self.generator = generator self.source = self.generator.source self.target = self.generator.target end |
Instance Attribute Details
#generator ⇒ Object
Returns the value of attribute generator.
4 5 6 |
# File 'lib/stack/server.rb', line 4 def generator @generator end |
#http_server ⇒ Object
Returns the value of attribute http_server.
5 6 7 |
# File 'lib/stack/server.rb', line 5 def http_server @http_server end |
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/stack/server.rb', line 3 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
3 4 5 |
# File 'lib/stack/server.rb', line 3 def target @target end |
#thread ⇒ Object
Returns the value of attribute thread.
6 7 8 |
# File 'lib/stack/server.rb', line 6 def thread @thread end |
Instance Method Details
#observe ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/stack/server.rb', line 14 def observe self.http_server = WEBrick::HTTPServer.new( :Port => Stack::runner.configuration.server_port, :DocumentRoot => self.target ) self.thread = Thread.new { self.http_server.start } trap("INT") { self.http_server.shutdown } self.thread.join() end |