class Dimples::Config

Configuration settings for a site.

Public Class Methods

defaults() click to toggle source
# 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
new(options = {}) click to toggle source
# File lib/dimples/config.rb, line 13
def initialize(options = {})
  @options = Config.defaults

  options&.each do |key, value|
    @options[key]&.merge!(value)
  end

  %i[sources output].each do |type|
    @options[type].each { |key, value| @options[type][key] = File.expand_path(value) }
  end
end

Public Instance Methods

[](key) click to toggle source
# File lib/dimples/config.rb, line 29
def [](key)
  @options[key]
end
dig(*args) click to toggle source
# File lib/dimples/config.rb, line 25
def dig(*args)
  @options.dig(*args)
end