Module: RIO::Ops::Path::URI

Extended by:
Forwardable
Included in:
CmdPipe::Stream::Reset, HTTP::Stream::Input, HTTP::Stream::Open, Empty, Str, Path::Stream::Open, Stream::Open
Defined in:
lib/rio/ops/path.rb

Instance Method Summary collapse

Instance Method Details

#abs(base = nil) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/rio/ops/path.rb', line 83

def abs(base=nil)
  if base.nil?
    nrio = new_rio(rl.abs)
    nrio
  else
    #new_rio(rl,{:base => ensure_rio(base).abs.to_uri}).abs
    brio = ensure_rio(base)
    new_rio(rl.abs(ensure_rio(base).to_s))
  end
end

#abs?Boolean Also known as: absolute?

Returns:

  • (Boolean)


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

def abs?
  rl.abs?
end

#baseObject



116
117
118
# File 'lib/rio/ops/path.rb', line 116

def base()
  new_rio(rl.base())
end

#merge(other) ⇒ Object



113
114
115
# File 'lib/rio/ops/path.rb', line 113

def merge(other)
  new_rio(rl.merge(ensure_rio(other).rl))
end

#rel(other = nil) ⇒ Object



100
101
102
103
104
105
106
107
108
109
# File 'lib/rio/ops/path.rb', line 100

def rel(other=nil)
  if other.nil?
    base = self.abs.dirname
  else
    new_rio(self.rl.abs.route_from(ensure_rio(other).rl.abs))
  end
  base = other.nil? ? self.abs : ensure_rio(other).dup
  base += '/' if base.directory? and base.to_s[-1] != '/'
  route_from(base)
end

#route_from(other) ⇒ Object



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

def route_from(other)
  new_rio(rl.abs.route_from(ensure_rio(other).rl.abs))
end

#route_to(other) ⇒ Object



110
111
112
# File 'lib/rio/ops/path.rb', line 110

def route_to(other)
  new_rio(rl.abs.route_to(ensure_rio(other).rl.abs))
end

#setbase(b) ⇒ Object



119
120
121
122
# File 'lib/rio/ops/path.rb', line 119

def setbase(b)
  rl.base(b)
  self
end