Class: Ore::Options
- Inherits:
-
Object
- Object
- Ore::Options
- Defined in:
- lib/ore/options.rb
Overview
Value object to contain ~/.ore/options.yml
data.
Constant Summary collapse
- DEFAULT_MARKUP =
Default markup
'markdown'
- DEFAULT_VERSION =
Default version
'0.1.0'
- DEFAULT_SUMMARY =
Default summary
%q{TODO: Summary}
- DEFAULT_DESCRIPTION =
Default description
%q{TODO: Description}
- DEFAULT_TEMPLATES =
Default templates
[ :git, :mit, :bundler, :rubygems_tasks, :rdoc, :rspec ]
- DEFAULTS =
Default options
{ markup: DEFAULT_MARKUP, version: DEFAULT_VERSION, summary: DEFAULT_SUMMARY, description: DEFAULT_DESCRIPTION }
Class Method Summary collapse
-
.load(path) ⇒ Options
Loads the options from a YAML file.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Accesses an option.
-
#initialize(options = {}) ⇒ Options
constructor
Initializes the options.
Constructor Details
Class Method Details
.load(path) ⇒ Options
Loads the options from a YAML file.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# 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 = {} data.each do |key,value| [key.to_sym] = value end return new() end |
Instance Method Details
#[](key) ⇒ Object
Accesses an option.
89 90 91 |
# File 'lib/ore/options.rb', line 89 def [](key) @options[key] end |