Sha256: 5bc2986981e54d3aa20eca7021b26f1c0d26124e904813c4cd86750e049fe55c

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 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] || []
      load_defaults = begin
                        d = options[:load_defaults]
                        d.nil? ? true : d
                      end
      if paths.flatten.empty?
        read_files(self.class.config_path.flatten)
      else
        read_files(paths.flatten)
      end
    end

    def config
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
confuse-0.1.5 lib/confuse/config.rb
confuse-0.1.4 lib/confuse/config.rb