Class: Alt::URI::FTP
Instance Attribute Summary
Attributes inherited from Base
#ext, #parts
Instance Method Summary
collapse
Methods included from Builders
create, create_, parse, parse_
#[], #[]=, #abs, #absolute?, #join, #rel, #relative?, #route_from, #route_to
Methods inherited from Base
#==, #length, #sub
Methods included from RIO::Fwd
#fwd, #fwd_reader, #fwd_readers, #fwd_writer, #fwd_writers
#basename, #basename=, #dirname, #dirname=, #extname, #extname=, #filename, #filename=, #netpath
Constructor Details
#initialize(parts = nil) ⇒ FTP
Returns a new instance of FTP.
329
330
331
332
333
334
|
# File 'lib/rio/alturi.rb', line 329
def initialize(parts=nil)
prts = parts || Alt::URI::Gen::URIParts.new
prts.scheme ||= 'ftp'
prts.host ||= ""
super(prts)
end
|
Instance Method Details
349
|
# File 'lib/rio/alturi.rb', line 349
def fspath() self.path end
|
#fspath=(val) ⇒ Object
350
|
# File 'lib/rio/alturi.rb', line 350
def fspath=(val) self.path = val end
|
#host=(val) ⇒ Object
396
397
398
|
# File 'lib/rio/alturi.rb', line 396
def host=(val)
parts.host = (val || "")
end
|
#initialize_copy(other) ⇒ Object
335
336
337
|
# File 'lib/rio/alturi.rb', line 335
def initialize_copy(other)
super
end
|
#normalize ⇒ Object
389
390
391
392
393
394
|
# File 'lib/rio/alturi.rb', line 389
def normalize
if self.port == '21'
self.port = nil
end
super
end
|
362
363
364
365
|
# File 'lib/rio/alturi.rb', line 362
def path
pth = parts._do_unesc(split_path_type[0])[1..-1]
pth
end
|
#path=(val) ⇒ Object
366
367
368
369
370
371
|
# File 'lib/rio/alturi.rb', line 366
def path=(val)
pth = parts._do_esc(val,:path).sub(%r{^/},'%2F')
typ = self.typecode
escpath = "/#{pth}" + (typ ? ";type=#{typ}" : "")
parts[:path] = escpath
end
|
#scheme=(val) ⇒ Object
400
401
402
|
# File 'lib/rio/alturi.rb', line 400
def scheme=(val)
parts.scheme = (val || 'ftp')
end
|
#split_path_type ⇒ Object
352
353
354
355
356
357
358
359
360
361
|
# File 'lib/rio/alturi.rb', line 352
def split_path_type
if parts[:path] =~ %r{(.+);type=([ai])$}
pth = $1
typ = $2
else
pth = parts[:path]
typ = nil
end
[pth,typ]
end
|
373
374
375
|
# File 'lib/rio/alturi.rb', line 373
def typecode
split_path_type[1]
end
|
#typecode=(val) ⇒ Object
376
377
378
379
380
381
|
# File 'lib/rio/alturi.rb', line 376
def typecode=(val)
v = val.to_s
raise ArgumentError,"typecode must be 'i' or 'a'" unless %w[i a].include?(v)
parts[:path].sub!(/;type=[ia]$/,";type=#{v}")
val
end
|
382
383
384
|
# File 'lib/rio/alturi.rb', line 382
def uri
parts.uri
end
|
#uri=(val) ⇒ Object
385
386
387
|
# File 'lib/rio/alturi.rb', line 385
def uri=(val)
parts.uri = val
end
|