Sha256: 4aebb2ea33b2e058510f82b8a49586f7982c6deb821b55f7b82b316cb2be65ea

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

# coding: utf-8

module Confuse
  module Source
    class << self
      def types
        @types ||= { }
      end

      def create(options = {})
        path = options[:path]

        type = if path
                 path[path.rindex('.') + 1, path.length].to_sym
               end
        type ||= options[:type]

        if type
          types[type].new(options)
        else
          Env.new(options)
        end
      end

      def register(type, klass)
        types[type] = klass
      end
    end
  end
end

require 'confuse/source/ini'
require 'confuse/source/yaml'
require 'confuse/source/env'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
confuse-1.1.1 lib/confuse/source.rb
confuse-1.1.0 lib/confuse/source.rb
confuse-1.0.0 lib/confuse/source.rb