module Config

Helpers for loading and interacting with configuration

Constants

CONFIG_PATH
DEFAULT_CONFIG_PATH

Public Instance Methods

config() click to toggle source
# File lib/game-finder/config.rb, line 12
def config
  @config ||= load_config(CONFIG_PATH)
end
install_default_config() click to toggle source
# File lib/game-finder/config.rb, line 22
def install_default_config
  # Skip using FileUtils.cp to avoid image magick installation
  File.write(CONFIG_PATH, File.read(DEFAULT_CONFIG_PATH))
end
load_config(config_path) click to toggle source
# File lib/game-finder/config.rb, line 16
def load_config(config_path)
  install_default_config unless File.exist? config_path
  c = symbolize(YAML.load_file(config_path))
  Struct.new(*c.keys).new(*c.values)
end