本文简要介绍ruby语言中 URI::FTP.build
的用法。
用法
build(args)
说明
从组件创建一个新的 URI::FTP
对象,并进行语法检查。
接受的组件是 userinfo
、 host
、 port
、 path
和 typecode
。
组件应以 Array
或 Hash
的形式提供,其键由组件名称前加冒号构成。
如果使用 Array
,则组件必须按 [userinfo, host, port, path, typecode]
的顺序传递。
如果提供的路径是绝对的,它将被转义以使其在 URI
中成为绝对路径。
例子:
require 'uri'
uri1 = URI::FTP.build(['user:password', 'ftp.example.com', nil,
'/path/file.zip', 'i'])
uri1.to_s # => "ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i"
uri2 = URI::FTP.build({:host => 'ftp.example.com',
:path => 'ruby/src'})
uri2.to_s # => "ftp://ftp.example.com/ruby/src"
调用超类方法
相关用法
- Ruby FTP.typecode=用法及代码示例
- Ruby Float arg()用法及代码示例
- Ruby File.identical?用法及代码示例
- Ruby Fiber.schedule用法及代码示例
- Ruby Float fdiv()用法及代码示例
- Ruby Float quo()用法及代码示例
- Ruby Float angle()用法及代码示例
- Ruby FileUtils.mkdir用法及代码示例
- Ruby Float divmod()用法及代码示例
- Ruby Float.self - other用法及代码示例
- Ruby Float.rationalize用法及代码示例
- Ruby Float.truncate用法及代码示例
- Ruby FileUtils.compare_file用法及代码示例
- Ruby FileUtils.options_of用法及代码示例
- Ruby File.dirname用法及代码示例
- Ruby Formatter.random_bytes用法及代码示例
- Ruby Float prev_float()用法及代码示例
- Ruby FileUtils.ln_s用法及代码示例
- Ruby Float round()用法及代码示例
- Ruby Float denominator()用法及代码示例
- Ruby Float numerator()用法及代码示例
- Ruby Float absolute()用法及代码示例
- Ruby Float to_i()用法及代码示例
- Ruby Fiddle.dlwrap用法及代码示例
- Ruby Float nan?()用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 FTP.build。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。