Module: Confuse::Source

Defined in:
lib/confuse/source.rb,
lib/confuse/source/env.rb,
lib/confuse/source/ini.rb,
lib/confuse/source/yaml.rb

Defined Under Namespace

Classes: Env, Ini, Yaml

Class Method Summary collapse

Class Method Details

.create(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/confuse/source.rb', line 10

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

.register(type, klass) ⇒ Object



25
26
27
# File 'lib/confuse/source.rb', line 25

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

.typesObject



6
7
8
# File 'lib/confuse/source.rb', line 6

def types
  @types ||= { }
end