Method: Ore::Config.options

Defined in:
lib/ore/config.rb

.optionsHash

Loads the default options from ~/.ore/options.yml.

Returns:

  • (Hash)

    The loaded default options.

Raises:

  • (RuntimeError)

    The ~/.ore/options.yml did not contain a YAML encoded Hash.

Since:

  • 0.9.0



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ore/config.rb', line 53

def Config.options
  options = {}

  if (@@enabled && File.file?(OPTIONS_FILE))
    new_options = YAML.load_file(OPTIONS_FILE)

    # default options must be a Hash
    unless new_options.kind_of?(Hash)
      raise("#{OPTIONS_FILE} must contain a YAML encoded Hash")
    end

    new_options.each do |name,value|
      options[name.to_sym] = value
    end
  end

  return options
end