Class: Musako::Configuration
- Inherits:
-
Hash
- Object
- Hash
- Musako::Configuration
- Defined in:
- lib/musako/configuration.rb
Constant Summary collapse
- DEFAULTS =
Default options.
{ source: Dir.pwd, destination: File.join(Dir.pwd, 'target'), views: 'views', assets: 'assets', posts: 'posts', port: '3333', host: '0.0.0.0', verbose: true, detach: false, author: 'nobody', title: 'my notes', description: 'my tech notes', timezone: 'UTC', site_url: 'http://pages.github.com' }
Instance Method Summary collapse
-
#read_config_file ⇒ Object
load YAML file.
- #symbolize_keys ⇒ Object
Instance Method Details
#read_config_file ⇒ Object
load YAML file.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/musako/configuration.rb', line 27 def read_config_file c = clone config = YAML.load_file(File.join(DEFAULTS[:source], "config.yml")) unless config.is_a? Hash raise ArgumentError.new("Configuration file: invalid #{file}") end c.merge(config) rescue SystemCallError raise LoadError, "Configuration file: not found #{file}" end |
#symbolize_keys ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/musako/configuration.rb', line 39 def symbolize_keys inject({}) do |, (key, value)| value = value.symbolize_keys if defined?(value.symbolize_keys) [(key.to_sym rescue key) || key] = value end end |