class Pgtk::Wire::Direct

Simple wire with details.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2019 Yegor Bugayenko

License

MIT

Public Class Methods

new(host:, port:, dbname:, user:, password:) click to toggle source

Constructor.

# File lib/pgtk/wire.rb, line 41
def initialize(host:, port:, dbname:, user:, password:)
  raise "The host can't be nil" if host.nil?
  @host = host
  raise "The host can't be nil" if host.nil?
  @port = port
  @dbname = dbname
  @user = user
  @password = password
end

Public Instance Methods

connection() click to toggle source

Create a new connection to PostgreSQL server.

# File lib/pgtk/wire.rb, line 52
def connection
  PG.connect(
    dbname: @dbname, host: @host, port: @port,
    user: @user, password: @password
  )
end