Class: Runner
- Inherits:
-
Object
- Object
- Runner
- 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) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Constructor Details
#initialize(host, port, client) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 16 |
# File 'lib/software_challenge_client/runner.rb', line 8 def initialize(host, port, client) puts 'Software Challenge 2015' puts 'Ruby Client' puts "Host: #{host}" puts "Port: #{port}" board = Board.new(true) @network = Network.new(host, port, board, client) end |
Instance Attribute Details
#network ⇒ Object (readonly)
Returns the value of attribute network.
6 7 8 |
# File 'lib/software_challenge_client/runner.rb', line 6 def network @network end |
Instance Method Details
#start ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/software_challenge_client/runner.rb', line 18 def start self.network.connect if self.network.connected == false puts 'Not connected' return end while self.network.connected self.network.processMessages sleep(0.01) end puts 'Program end...' self.network.disconnect end |