In: |
uri/ftp.rb
|
Parent: | Generic |
RFC1738 section 3.2.
DEFAULT_PORT | = | 21 |
COMPONENT | = | [ :scheme, :userinfo, :host, :port, :path, :typecode |
TYPECODE | = | ['a', 'i', 'd'].freeze |
TYPECODE_PREFIX | = | ';type='.freeze |
typecode | [R] |
# File uri/ftp.rb, line 50 def self.new2(user, password, host, port, path, typecode = nil, arg_check = true) typecode = nil if typecode.size == 0 if typecode && !TYPECODE.include?(typecode) raise ArgumentError, "bad typecode is specified: #{typecode}" end # do escape self.new('ftp', [user, password], host, port, nil, typecode ? path + TYPECODE_PREFIX + typecode : path, nil, nil, nil, arg_check) end
# File uri/ftp.rb, line 67 def self.build(args) tmp = Util::make_components_hash(self, args) if tmp[:typecode] if tmp[:typecode].size == 1 tmp[:typecode] = TYPECODE_PREFIX + tmp[:typecode] end tmp[:path] << tmp[:typecode] end return super(tmp) end
# File uri/ftp.rb, line 80 def initialize(*arg) super(*arg) @typecode = nil tmp = @path.index(TYPECODE_PREFIX) if tmp typecode = @path[tmp + TYPECODE_PREFIX.size..-1] self.set_path(@path[0..tmp - 1]) if arg[-1] self.typecode = typecode else self.set_typecode(typecode) end end end
# File uri/ftp.rb, line 116 def typecode=(typecode) check_typecode(typecode) set_typecode(typecode) typecode end