class Modsvaskr::Config
Configuration
Public Class Methods
new(file)
click to toggle source
Constructor
- Parameters
-
file (String): File containing configuration
# File lib/modsvaskr/config.rb, line 14 def initialize(file) @config = YAML.safe_load(File.read(file)) || {} # Parse all game types plugins # Hash<Symbol, Class> @game_types = Dir.glob("#{__dir__}/games/*.rb").map do |game_type_file| require game_type_file base_name = File.basename(game_type_file, '.rb') [ base_name.to_sym, Games.const_get(base_name.split('_').collect(&:capitalize).join.to_sym) ] end.to_h end
Public Instance Methods
auto_keys()
click to toggle source
Return the automated keys to apply
- Result
-
Array<String>: The list of automated keys
# File lib/modsvaskr/config.rb, line 64 def auto_keys @config['auto_keys'] || [] end
games()
click to toggle source
Get the games list
- Result
-
Array<Game>: List of games
# File lib/modsvaskr/config.rb, line 32 def games unless defined?(@games) @games = (@config['games'] || []).map do |game_info| game_type = game_info['type'].to_sym raise "Unknown game type: #{game_type}. Available ones are #{@game_types.keys.join(', ')}" unless @game_types.key?(game_type) @game_types[game_type].new(self, game_info) end end @games end
no_prompt()
click to toggle source
seven_zip_path()
click to toggle source
Return the 7-Zip path
- Result
-
String: The 7-Zip path
# File lib/modsvaskr/config.rb, line 56 def seven_zip_path @config['7zip'] end
xedit_path()
click to toggle source
Return the xEdit path
- Result
-
String: The xEdit path
# File lib/modsvaskr/config.rb, line 48 def xedit_path @config['xedit'] end