From d09dd26c3d834818b39147159f8a7792d78dcbdb Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Tue, 12 Nov 2024 14:21:49 +0000 Subject: [PATCH] Use `URI::RFC2396_PARSER.regexp[:ABS_URI_REF]` directly to resolve deprecation warning https://github.com/ruby/uri/pull/107 https://github.com/ruby/uri/pull/113 --- CHANGELOG.md | 1 + lib/pg/aws_rds_iam/connection_info/uri.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 176c258..b18d64f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed * Test against Active Record 8.0 ([#685](https://github.com/haines/pg-aws_rds_iam/pull/685)) +* Use `URI::RFC2396_PARSER.regexp[:ABS_URI_REF]` directly to resolve deprecation warning introduced in [ruby/uri#113](https://github.com/ruby/uri/pull/113) ([#685](https://github.com/haines/pg-aws_rds_iam/pull/685)) ## [0.6.0] - 2024-10-30 diff --git a/lib/pg/aws_rds_iam/connection_info/uri.rb b/lib/pg/aws_rds_iam/connection_info/uri.rb index 8ed5823..b610245 100644 --- a/lib/pg/aws_rds_iam/connection_info/uri.rb +++ b/lib/pg/aws_rds_iam/connection_info/uri.rb @@ -5,7 +5,14 @@ module AWS_RDS_IAM module ConnectionInfo class URI def self.match?(connection_string) - /\A#{::URI::ABS_URI_REF}\z/.match?(connection_string) + regexp = + if defined?(::URI::RFC2396_PARSER) + ::URI::RFC2396_PARSER.regexp[:ABS_URI_REF] + else + ::URI::ABS_URI_REF + end + + /\A#{regexp}\z/.match?(connection_string) end attr_reader :auth_token_generator_name