Class: Settlers::Java

Inherits:
Object
  • Object
show all
Defined in:
lib/settlers/java.rb

Constant Summary collapse

JAR =
Settlers.datadir.join('jsettlers-1.1.09', 'JSettlers.jar')

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name) ⇒ Java

Returns a new instance of Java.



13
14
15
# File 'lib/settlers/java.rb', line 13

def initialize(class_name)
  @class_name = class_name
end

Class Method Details

.clientObject



7
8
9
# File 'lib/settlers/java.rb', line 7

def self.client
  new('soc.client.SOCPlayerClient')
end

.serverObject



3
4
5
# File 'lib/settlers/java.rb', line 3

def self.server
  new('soc.server.SOCServer')
end

Instance Method Details

#run(*args) ⇒ Object



17
18
19
20
# File 'lib/settlers/java.rb', line 17

def run(*args)
  pid = quietly_fork(args)
  Process.waitpid(pid)
end

#start(*args) ⇒ Object



22
23
24
25
# File 'lib/settlers/java.rb', line 22

def start(*args)
  pid = quietly_fork(args)
  at_exit { Process.kill 'INT', pid }
end