instance method
Gem::LocalRemoteOptions#accept_uri_http
accept_uri_http
lib/rubygems/local_remote_options.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/local_remote_options.rb, line 19
def accept_uri_http
Gem::OptionParser.accept Gem::URI::HTTP do |value|
begin
uri = Gem::URI.parse value
rescue Gem::URI::InvalidURIError
raise Gem::OptionParser::InvalidArgument, value
end
valid_uri_schemes = ["http", "https", "file", "s3"]
unless valid_uri_schemes.include?(uri.scheme)
msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map {|s| "#{s}://" }}"
raise ArgumentError, msg
end
value
end
end
Allows Gem::OptionParser to handle HTTP URIs.
See also
#add_bulk_threshold_option
#add_clear_sources_option
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0