Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
URI::FTP.new
(::String? scheme, ::String? userinfo, ::String? host, (::String | ::Integer)? port, nil registry, ::String? path, ::String? opaque, ::String? query, ::String? fragment, ?untyped parser, ?::boolish arg_check) -> ::URI::FTP
new(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = nil, arg_check = false)
lib/uri/ftp.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/uri/ftp.rb, line 133
def initialize(scheme,
userinfo, host, port, registry,
path, opaque,
query,
fragment,
parser = nil,
arg_check = false)
raise InvalidURIError unless path
path = path.sub(/^\//,'')
path.sub!(/^%2F/,'/')
super(scheme, userinfo, host, port, registry, path, opaque,
query, fragment, parser, arg_check)
@typecode = nil
if tmp = @path.index(TYPECODE_PREFIX)
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
@path = @path[0..tmp - 1]
if arg_check
self.typecode = typecode
else
self.set_typecode(typecode)
end
end
end
Description
Creates a new URI::FTP object from generic URL components with no syntax checking.
Unlike build(), this method does not escape the path component as required by RFC1738; instead it is treated as per RFC2396.
Arguments are scheme, userinfo, host, port, registry, path, opaque, query, and fragment, in that order.