Class: Pgtk::Wire::Direct
- Inherits:
-
Object
- Object
- Pgtk::Wire::Direct
- Defined in:
- lib/pgtk/wire.rb
Overview
Simple wire with details.
- Author
-
Yegor Bugayenko (yegor256@gmail.com)
- Copyright
-
Copyright © 2019-2026 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#connection ⇒ Object
Create a new connection to PostgreSQL server.
-
#initialize(host:, port:, dbname:, user:, password:) ⇒ Direct
constructor
Constructor.
Constructor Details
#initialize(host:, port:, dbname:, user:, password:) ⇒ Direct
Constructor.
28 29 30 31 32 33 34 35 36 |
# File 'lib/pgtk/wire.rb', line 28 def initialize(host:, port:, dbname:, user:, password:) raise(ArgumentError, "The host can't be nil") if host.nil? @host = host raise(ArgumentError, "The port can't be nil") if port.nil? @port = port @dbname = dbname @user = user @password = password end |
Instance Method Details
#connection ⇒ Object
Create a new connection to PostgreSQL server.
39 40 41 |
# File 'lib/pgtk/wire.rb', line 39 def connection PG.connect(dbname: @dbname, host: @host, port: @port, user: @user, password: @password) end |