Skip to content

Commit

Permalink
Remove ruby/uri requirement
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daniel-niknam authored and deivid-rodriguez committed Aug 24, 2021
1 parent 21dcdd2 commit 241e093
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rubygems/printable_uri.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'uri'
require_relative 'uri_parser'

class Gem::PrintableUri
Expand All @@ -22,7 +21,10 @@ def parse_uri
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?
Expand Down

0 comments on commit 241e093

Please sign in to comment.