class Rushour::ServerProcess

Constants

CMD_PAUSE
CMD_STOP
CMD_UNPAUSE

Public Class Methods

new() click to toggle source
# File lib/rushour/server_process.rb, line 9
def initialize
  @ottd_server = ChildProcess.build(Rushour::Settings.executable, '-D')
  @ottd_server.io.stdout = STDOUT
  @ottd_server.io.stderr = STDERR
  @ottd_server.duplex = true
end

Public Instance Methods

pause() click to toggle source
# File lib/rushour/server_process.rb, line 25
def pause
  @ottd_server.io.stdin.puts CMD_PAUSE
end
start() click to toggle source
# File lib/rushour/server_process.rb, line 16
def start
  @ottd_server.start
end
stop() click to toggle source
# File lib/rushour/server_process.rb, line 20
def stop
  @ottd_server.io.stdin.puts CMD_STOP
  @ottd_server.wait
end
unpause() click to toggle source
# File lib/rushour/server_process.rb, line 29
def unpause
  @ottd_server.io.stdin.puts CMD_UNPAUSE
end