Sha256: 585e199d25502ac6d31e467748f80620caaef8c4958c5dedb6ecc8ef2a9283d2

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

require 'confuse/config_mixin'
require 'confuse/dsl'

module Confuse
  # The default module used for configuration.
  module Config
    extend ConfigMixin
  end

  # Super class for configuration in order to have multiple instances.
  class ConfigBase
    include ConfigMixin
    extend DSL

    def namespaces
      @namespaces ||= {}
    end

    def initialize(options = {})
      load_namespaces(self.class.namespaces.clone)
      paths = options[:paths] || []
      if paths.flatten.empty?
        read_files(self.class.config_path.flatten)
      else
        read_files(paths.flatten)
      end
      options[:conf].tap { |conf| conf && mixin_config!(conf) }
    end

    def config
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
confuse-0.1.6 lib/confuse/config.rb