Class: Dimples::Config
- Inherits:
-
Object
- Object
- Dimples::Config
- Defined in:
- lib/dimples/config.rb
Overview
Configuration settings for a site.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #dig(*args) ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dimples/config.rb', line 13 def initialize( = {}) @options = Config.defaults &.each do |key, value| @options[key]&.merge!(value) end %i[sources output].each do |type| @options[type].each { |key, value| @options[type][key] = File.(value) } end end |
Class Method Details
.defaults ⇒ Object
6 7 8 9 10 11 |
# File 'lib/dimples/config.rb', line 6 def self.defaults { sources: { root: '.', posts: './posts', pages: './pages', layouts: './layouts', static: './static' }, output: { root: './site', posts: './site/posts', categories: './site/categories' } } end |
Instance Method Details
#[](key) ⇒ Object
29 30 31 |
# File 'lib/dimples/config.rb', line 29 def [](key) @options[key] end |
#dig(*args) ⇒ Object
25 26 27 |
# File 'lib/dimples/config.rb', line 25 def dig(*args) @options.dig(*args) end |