Class: GameMachine::AppConfig
- Inherits:
-
Object
- Object
- GameMachine::AppConfig
- Includes:
- Singleton
- Defined in:
- lib/game_machine/app_config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ AppConfig
constructor
A new instance of AppConfig.
- #load_config(name) ⇒ Object
- #reload ⇒ Object
- #server_config(server) ⇒ Object
- #set_defaults ⇒ Object
Constructor Details
#initialize ⇒ AppConfig
9 10 11 |
# File 'lib/game_machine/app_config.rb', line 9 def initialize @config = OpenStruct.new end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/game_machine/app_config.rb', line 7 def config @config end |
Instance Method Details
#load_config(name) ⇒ Object
34 35 36 37 38 |
# File 'lib/game_machine/app_config.rb', line 34 def load_config(name) config.name = name set_defaults load_settings(name) end |
#reload ⇒ Object
13 14 15 16 |
# File 'lib/game_machine/app_config.rb', line 13 def reload @config = OpenStruct.new load_config end |
#server_config(server) ⇒ Object
18 19 20 |
# File 'lib/game_machine/app_config.rb', line 18 def server_config(server) Settings.servers.send(server) end |
#set_defaults ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/game_machine/app_config.rb', line 22 def set_defaults unless config.request_handler_routers config.request_handler_routers = 10 end unless config.game_handler_routers config.game_handler_routers = 10 end unless config.udp_routers config.udp_routers = 10 end end |