Module: Settings::DataSource::Build

Defined in:
lib/settings/data_source/build.rb

Class Method Summary collapse

Class Method Details

.call(input = nil) ⇒ Object Also known as: !



4
5
6
7
# File 'lib/settings/data_source/build.rb', line 4

def self.call(input=nil)
  data_source_type = type(input)
  data_source_type.build(input)
end

.type(input = nil) ⇒ Object

Raises:



10
11
12
13
14
15
16
# File 'lib/settings/data_source/build.rb', line 10

def self.type(input=nil)
  return Settings::DataSource::Hash if input.is_a?(::Hash)
  return Settings::DataSource::File if input.is_a?(String) || input.nil?
  return Settings::DataSource::Env if input.instance_of?(Object)

  raise Settings::Error, "Input is not supported: #{input}"
end