Module: Alt::URI::Ops::Generic

Included in:
FTP, File, Generic, HTTP
Defined in:
lib/rio/alturi.rb

Instance Method Summary collapse

Instance Method Details

#[](sym) ⇒ Object



85
86
87
# File 'lib/rio/alturi.rb', line 85

def [](sym)
  parts[sym]
end

#[]=(sym, val) ⇒ Object



89
90
91
# File 'lib/rio/alturi.rb', line 89

def []=(sym,val)
  parts[sym] = val
end

#abs(base) ⇒ Object



101
102
103
# File 'lib/rio/alturi.rb', line 101

def abs(base)
  Alt::URI::Factory.from_parts(parts.abs(base.parts))
end

#absolute?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/rio/alturi.rb', line 93

def absolute?
  parts.absolute?
end

#join(*a) ⇒ Object



114
115
116
117
118
# File 'lib/rio/alturi.rb', line 114

def join(*a)
  pthstr = a.map(&:to_s).join('/')
  newpth = (self.path + (a.empty? || self.path.empty? ? '' : '/') + pthstr).squeeze('/')
  self.path = newpth
end

#rel(base) ⇒ Object



105
106
107
# File 'lib/rio/alturi.rb', line 105

def rel(base)
  Alt::URI::Factory.from_parts(parts.rel(base.parts))
end

#relative?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/rio/alturi.rb', line 97

def relative?
  parts.relative?
end

#route_from(other) ⇒ Object



108
109
110
# File 'lib/rio/alturi.rb', line 108

def route_from(other)
  self.rel(other)
end

#route_to(other) ⇒ Object



111
112
113
# File 'lib/rio/alturi.rb', line 111

def route_to(other)
  other.rel(self)
end