Sha256: f93bcacb184ca23dbf0747060e0aa3d964b7f0d0f21f747fa116fec6fecab8c8

Contents?: true

Size: 391 Bytes

Versions: 2

Compression:

Stored size: 391 Bytes

Contents

# frozen_string_literal: true

module ActiveRecordPostgresqlXverify
  module Utils
    class << self
      def pg_connection_info(conn)
        cih = conn.conninfo_hash
        "host=#{cih[:host]}, database=#{cih[:dbname]}, username=#{cih[:user]}"
      end

      def pg_ping(conn)
        conn.query 'SELECT 1'
        true
      rescue PG::Error
        false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_postgresql_xverify-0.2.0 lib/active_record_postgresql_xverify/utils.rb
active_record_postgresql_xverify-0.1.1 lib/active_record_postgresql_xverify/utils.rb