Class: ORMakers::DBCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/ormakers/db_credentials.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = ENV['DATABASE_URL']) ⇒ DBCredentials

Returns a new instance of DBCredentials.



3
4
5
# File 'lib/ormakers/db_credentials.rb', line 3

def initialize(url = ENV['DATABASE_URL'])
  @url = url[11..-1]
end

Instance Method Details

#to_hashObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/ormakers/db_credentials.rb', line 7

def to_hash
  {
    host: host,
    port: port,
    dbname: dbname,
    user: user,
    password: password,
    sslmode: 'require'
  }
end