Class: Settlers::Application

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

Defined Under Namespace

Classes: BonjourClientGame, Client, RemoteServer, Server, StandaloneGame

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Application

Returns a new instance of Application.



13
14
15
16
17
18
# File 'lib/settlers/application.rb', line 13

def initialize(*args)
  self.server = Server.new
  self.client = Client.new
  self.style  = StandaloneGame
  parse_options(args)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



11
12
13
# File 'lib/settlers/application.rb', line 11

def client
  @client
end

#serverObject

Returns the value of attribute server.



11
12
13
# File 'lib/settlers/application.rb', line 11

def server
  @server
end

#styleObject

Returns the value of attribute style.



11
12
13
# File 'lib/settlers/application.rb', line 11

def style
  @style
end

Instance Method Details

#find_serverObject



32
33
34
# File 'lib/settlers/application.rb', line 32

def find_server
  choose(*available_servers)
end

#runObject



20
21
22
# File 'lib/settlers/application.rb', line 20

def run
  style.new(self).run
end

#start_client(server) ⇒ Object



28
29
30
# File 'lib/settlers/application.rb', line 28

def start_client(server)
  client.start(server)
end

#start_serverObject



24
25
26
# File 'lib/settlers/application.rb', line 24

def start_server
  server.start
end