End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
URI.for
for(scheme, *arguments, default: Generic)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/uri/common.rb, line 95
def self.for(scheme, *arguments, default: Generic)
const_name = scheme.to_s.upcase
uri_class = INITIAL_SCHEMES[const_name]
uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false)
Schemes.const_get(const_name, false)
end
uri_class ||= default
return uri_class.new(scheme, *arguments)
end
Construct a URI instance, using the scheme to detect the appropriate class from URI.scheme_list.