Class: Runner
- Inherits:
-
Object
- Object
- Runner
- Includes:
- Logging
- Defined in:
- lib/software_challenge_client/runner.rb
Instance Attribute Summary collapse
-
#network ⇒ Object
readonly
Returns the value of attribute network.
Instance Method Summary collapse
-
#initialize(host, port, client, reservation = nil) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Methods included from Logging
Constructor Details
#initialize(host, port, client, reservation = nil) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 17 18 19 |
# File 'lib/software_challenge_client/runner.rb', line 11 def initialize(host, port, client, reservation = nil) logger.info 'Software Challenge 2017' logger.info 'Ruby Client' logger.info "Host: #{host}" logger.info "Port: #{port}" board = Board.new() @network = Network.new(host, port, board, client, reservation) end |
Instance Attribute Details
#network ⇒ Object (readonly)
Returns the value of attribute network.
9 10 11 |
# File 'lib/software_challenge_client/runner.rb', line 9 def network @network end |
Instance Method Details
#start ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/software_challenge_client/runner.rb', line 21 def start self.network.connect if self.network.connected == false logger.error 'Not connected' return end while self.network.connected self.network.processMessages sleep(0.01) end logger.info 'Program end...' self.network.disconnect end |