module Bundler::URI
def self.for(scheme, *arguments, default: Generic)
# => #
Bundler::URI.for('foo', *values, default: Bundler::URI::HTTP)
# => #
Bundler::URI.for('https', *values)
values = ['john.doe', 'www.example.com', '123', nil, '/forum/questions/', nil, 'tag=networking&order=newest', 'top']
Examples:
See Bundler::URI::Generic.new.
using +scheme+ and +arguments+.
- The object is initialized by calling the class initializer
- The new object is an instance of Bundler::URI.scheme_list[scheme.upcase].
and +default+:
Returns a new object constructed from the given +scheme+, +arguments+,
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