Module: Db2Query::Config::ClassMethods

Defined in:
lib/db2_query/config.rb

Constant Summary collapse

@@configurations =
nil

Instance Method Summary collapse

Instance Method Details

#default_pathObject



17
18
19
# File 'lib/db2_query/config.rb', line 17

def default_path
  "#{Rails.root}/config/db2query.yml"
end

#load_database_configurations(path = nil) ⇒ Object



21
22
23
24
25
26
# File 'lib/db2_query/config.rb', line 21

def load_database_configurations(path = nil)
  config_file = IO.read(path || default_path)
  @@configurations = YAML.load(config_file)[DEFAULT_ENV.call].transform_keys(&:to_sym)
rescue Exception => e
  raise Db2Query::Error, e.message
end