Class: CARPS::Player::GameConfig
- Inherits:
-
SessionConfig
- Object
- YamlConfig
- UserConfig
- SessionConfig
- CARPS::Player::GameConfig
- Defined in:
- lib/carps/service/player/config.rb
Overview
Class to read game configuration files
Instance Method Summary collapse
-
#display ⇒ Object
Display information on this configuration.
-
#filename=(fn) ⇒ Object
Set the file name.
-
#initialize(filename, mod, dm, about, session) ⇒ GameConfig
constructor
Create a new GameConfig.
-
#parse_yaml(conf) ⇒ Object
Parse a game config file.
-
#spawn ⇒ Object
Spawn a game object so we can resume the game.
Methods inherited from SessionConfig
#load_mod, #register_session, #save, #save_mod
Methods inherited from UserConfig
Methods inherited from YamlConfig
Constructor Details
#initialize(filename, mod, dm, about, session) ⇒ GameConfig
Create a new GameConfig
31 32 33 34 35 36 |
# File 'lib/carps/service/player/config.rb', line 31 def initialize filename, mod, dm, about, session super session, filename @mod = mod @dm = dm @about = about end |
Instance Method Details
#display ⇒ Object
Display information on this configuration
52 53 54 55 56 57 |
# File 'lib/carps/service/player/config.rb', line 52 def display puts "Mod: " + @mod puts "Description:" puts @about puts "DM: " + @dm end |
#filename=(fn) ⇒ Object
Set the file name
39 40 41 |
# File 'lib/carps/service/player/config.rb', line 39 def filename= fn @filename = fn end |
#parse_yaml(conf) ⇒ Object
Parse a game config file
44 45 46 47 48 49 |
# File 'lib/carps/service/player/config.rb', line 44 def parse_yaml conf super @mod = read_conf conf, "mod" @about = read_conf conf, "about" @dm = read_conf conf, "dm" end |
#spawn ⇒ Object
Spawn a game object so we can resume the game
60 61 62 |
# File 'lib/carps/service/player/config.rb', line 60 def spawn GameClient.new @dm, @mod, self end |