Class: PostPolicy::Config::Db

Inherits:
Object
  • Object
show all
Defined in:
lib/postpolicy/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dbconfigObject (readonly)

Returns the value of attribute dbconfig.



34
35
36
# File 'lib/postpolicy/config.rb', line 34

def dbconfig
  @dbconfig
end

.dbi_paramsObject (readonly)

Returns the value of attribute dbi_params.



34
35
36
# File 'lib/postpolicy/config.rb', line 34

def dbi_params
  @dbi_params
end

Class Method Details

.load(filename) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/postpolicy/config.rb', line 36

def load( filename )
  if filename 
    @dbconfig = YAML.load_file( filename ).stringify_keys!.freeze
    require "do_#{@dbconfig[:driver]}"
    @dbi_params = "#{@dbconfig[:driver]}://#{@dbconfig[:user]}:#{@dbconfig[:password]}@#{@dbconfig[:host]}:#{@dbconfig[:port]}/#{@dbconfig[:database]}"
  end
end