Class: TrafficLightController::Server
- Inherits:
-
Object
- Object
- TrafficLightController::Server
- Defined in:
- lib/traffic_light_controller/server.rb
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #work ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/traffic_light_controller/server.rb', line 4 def initialize Thread.abort_on_exception = true @config = Config.new @server = TCPServer.new(config.server.address, config.server.port) @current_path = "" rescue Errno::EADDRINUSE address_in_use_error(config.server) rescue Errno::EADDRNOTAVAIL, SocketError address_not_available_error(config.server.address) end |
Instance Method Details
#work ⇒ Object
15 16 17 18 19 |
# File 'lib/traffic_light_controller/server.rb', line 15 def work while(true) start_thread_and_do_work end end |