Class: PgBouncerHero::Connection
- Inherits:
-
Object
- Object
- PgBouncerHero::Connection
- Defined in:
- lib/pgbouncerhero/connection.rb
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(host, port, user, password, dbname) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(host, port, user, password, dbname) ⇒ Connection
Returns a new instance of Connection.
4 5 6 7 8 9 10 |
# File 'lib/pgbouncerhero/connection.rb', line 4 def initialize(host, port, user, password, dbname) @host = host @port = port @user = user @password = password @dbname = dbname end |
Instance Method Details
#connection ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pgbouncerhero/connection.rb', line 12 def connection @connection ||= begin begin PG.connect( host: @host, port: @port, user: @user, password: @password, dbname: @dbname, connect_timeout: 5 ) rescue => e Rails.logger.info(e) nil end end end |