class Ore::Options
Value object to contain ‘~/.ore/options.yml` data.
@since 0.11.0
Constants
- DEFAULTS
Default options
- DEFAULT_DESCRIPTION
Default description
- DEFAULT_MARKUP
Default markup
- DEFAULT_SUMMARY
Default summary
- DEFAULT_TEMPLATES
Default templates
- DEFAULT_VERSION
Default version
Public Class Methods
load(path)
click to toggle source
Loads the options from a YAML file.
@param [String] path
Path to the options file.
@return [Options]
The loaded options.
@raise [RuntimeError]
The file contained malformed YAML.
# File lib/ore/options.rb, line 64 def self.load(path) data = YAML.load_file(path) unless data.kind_of?(Hash) raise("#{path} must contain a YAML encoded Hash") end options = {} data.each do |key,value| options[key.to_sym] = value end return new(options) end
new(options={})
click to toggle source
Initializes the options.
@param [Hash{Symbol => Object}] options
The options hash.
# File lib/ore/options.rb, line 48 def initialize(options={}) @options = DEFAULTS.merge(options) end
Public Instance Methods
[](key)
click to toggle source
Accesses an option.
@param [Symbol] key
The option name.
@return [Object]
The option value.
# File lib/ore/options.rb, line 89 def [](key) @options[key] end