Module: Alt::URI::Factory

Defined in:
lib/rio/alturi.rb

Class Method Summary collapse

Class Method Details

.create(hash) ⇒ Object



430
431
432
433
# File 'lib/rio/alturi.rb', line 430

def self.create(hash)
  u = Alt::URI::Gen::URIParts.create(hash)
  from_parts(u)
end

.from_parts(u) ⇒ Object



412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/rio/alturi.rb', line 412

def self.from_parts(u)
  case u.scheme
  when 'file'
    Alt::URI::File.new(u)
  when 'http'
    Alt::URI::HTTP.new(u)
  when 'ftp'
    Alt::URI::FTP.new(u)
  else
    Alt::URI::Generic.new(u)
  end
end

.parse(str, opts = {}) ⇒ Object



425
426
427
428
# File 'lib/rio/alturi.rb', line 425

def self.parse(str,opts={})
  u = Alt::URI::Gen::URIParts.parse(str,opts)
  from_parts(u)
end