Class: RubyArmor::WarriorConfig
- Inherits:
-
BaseUserData
- Object
- BaseUserData
- RubyArmor::WarriorConfig
- Defined in:
- lib/ruby_armor/warrior_config.rb
Constant Summary collapse
- DEFAULT_CONFIG =
File. "../../../config/default_config.yml", __FILE__
- OLD_CONFIG_FILE =
"ruby_armour.yml"
- CONFIG_FILE =
"ruby_armor/config.yml"
Instance Method Summary collapse
-
#initialize(profile) ⇒ WarriorConfig
constructor
A new instance of WarriorConfig.
- #turn_delay ⇒ Object
- #turn_delay=(delay) ⇒ Object
- #warrior_class ⇒ Object
- #warrior_class=(warrior_class) ⇒ Object
Constructor Details
#initialize(profile) ⇒ WarriorConfig
Returns a new instance of WarriorConfig.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ruby_armor/warrior_config.rb', line 11 def initialize(profile) # Originally, config file was just in the folder. Move into its own folder, so we can put more in there. old_config_file = File.join(profile.player_path, OLD_CONFIG_FILE) config_file = File.join(profile.player_path, CONFIG_FILE) if File.exists? old_config_file FileUtils.mkdir_p File.dirname(config_file) FileUtils.mv old_config_file, config_file end super config_file, DEFAULT_CONFIG end |
Instance Method Details
#turn_delay ⇒ Object
23 |
# File 'lib/ruby_armor/warrior_config.rb', line 23 def turn_delay; data[:turn_delay]; end |
#turn_delay=(delay) ⇒ Object
24 25 26 27 |
# File 'lib/ruby_armor/warrior_config.rb', line 24 def turn_delay=(delay) data[:turn_delay] = delay save end |
#warrior_class ⇒ Object
29 |
# File 'lib/ruby_armor/warrior_config.rb', line 29 def warrior_class; data[:warrior_class]; end |
#warrior_class=(warrior_class) ⇒ Object
30 31 32 33 |
# File 'lib/ruby_armor/warrior_config.rb', line 30 def warrior_class=(warrior_class) data[:warrior_class] = warrior_class save end |