class Bundler::URI::RFC3986_Parser

def split(uri) #:nodoc:

:nodoc:
def split(uri) #:nodoc:
  begin
    uri = uri.to_str
  rescue NoMethodError
    raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
  end
  uri.ascii_only? or
    raise InvalidURIError, "Bundler::URI must be ascii only #{uri.dump}"
  if m = RFC3986_URI.match(uri)
    query = m["query".freeze]
    scheme = m["scheme".freeze]
    opaque = m["path-rootless".freeze]
    if opaque
      opaque << "?#{query}" if query
      [ scheme,
        nil, # userinfo
        nil, # host
        nil, # port
        nil, # registry
        nil, # path
        opaque,
        nil, # query
        m["fragment".freeze]
      ]
    else # normal
      [ scheme,
        m["userinfo".freeze],
        m["host".freeze],
        m["port".freeze],
        nil, # registry
        (m["path-abempty".freeze] ||
         m["path-absolute".freeze] ||
         m["path-empty".freeze]),
        nil, # opaque
        query,
        m["fragment".freeze]
      ]
    end
  elsif m = RFC3986_relative_ref.match(uri)
    [ nil, # scheme
      m["userinfo".freeze],
      m["host".freeze],
      m["port".freeze],
      nil, # registry,
      (m["path-abempty".freeze] ||
       m["path-absolute".freeze] ||
       m["path-noscheme".freeze] ||
       m["path-empty".freeze]),
      nil, # opaque
      m["query".freeze],
      m["fragment".freeze]
    ]
  else
    raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
  end
end