[前][次][番号順一覧][スレッド一覧]

ruby-changes:67476

From: Daniel <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:56 +0900 (JST)
Subject: [ruby-changes:67476] 6d883b33ae (master): [rubygems/rubygems] Remove `ruby/uri` requirement

https://git.ruby-lang.org/ruby.git/commit/?id=6d883b33ae

From 6d883b33aef68c3ae9455a591c40a1ffb5836886 Mon Sep 17 00:00:00 2001
From: Daniel Niknam <mhmd.niknam@g...>
Date: Mon, 23 Aug 2021 23:01:17 +1000
Subject: [rubygems/rubygems] Remove `ruby/uri` requirement

For the purpose of this class, we need to make sure the return object by `Gem::UriParser.parse_uri` method will have the following method:
- user
- user=
- password
- password=
So we  can remove the the `uri` dependency and just look for the methods to exist.

https://github.com/rubygems/rubygems/commit/241e093597
---
 lib/rubygems/printable_uri.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/rubygems/printable_uri.rb b/lib/rubygems/printable_uri.rb
index 0837c42..ad88df0 100644
--- a/lib/rubygems/printable_uri.rb
+++ b/lib/rubygems/printable_uri.rb
@@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/printable_uri.rb#L1
 # frozen_string_literal: true
 
-require 'uri'
 require_relative 'uri_parser'
 
 class Gem::PrintableUri
@@ -22,7 +21,10 @@ class Gem::PrintableUri https://github.com/ruby/ruby/blob/trunk/lib/rubygems/printable_uri.rb#L21
   end
 
   def valid_uri?
-    @uri.is_a? URI::Generic
+    @uri.respond_to?(:user) &&
+      @uri.respond_to?(:user=) &&
+      @uri.respond_to?(:password) &&
+      @uri.respond_to?(:password=)
   end
 
   def credential_redacted?
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]