Module: RIO::Ops::Path::Query

Included in:
HTTP::Stream::Input, HTTP::Stream::Open, Str, Path::Stream::Open
Defined in:
lib/rio/ops/path.rb

Instance Method Summary collapse

Instance Method Details

#+(arg) ⇒ Object



178
179
180
# File 'lib/rio/ops/path.rb', line 178

def +(arg)
  new_rio(softreset.to_str + ensure_rio(arg).to_str)
end

#basename(*args) ⇒ Object



154
155
156
157
158
159
160
# File 'lib/rio/ops/path.rb', line 154

def basename(*args)
  unless args.empty?
    ex = args[0] || self.extname
    self.ext(ex)
  end
   new_rio(rl.basename(self.ext?))
end

#dirname(*args) ⇒ Object



164
165
166
# File 'lib/rio/ops/path.rb', line 164

def dirname(*args)
  new_rio(uri.dirname)
end

#expand_path(*args) ⇒ Object



137
138
139
140
# File 'lib/rio/ops/path.rb', line 137

def expand_path(*args)
  args[0] = args[0].to_s unless args.empty?
  new_rio(fs.expand_path(self.to_s,*args))
end

#extname(*args) ⇒ Object



141
142
143
144
# File 'lib/rio/ops/path.rb', line 141

def extname(*args) 
  en = fs.extname(rl.path_no_slash,*args) 
  (en.empty? ? nil : en)
end

#filenameObject



161
162
163
# File 'lib/rio/ops/path.rb', line 161

def filename()
  new_rio(rl.filename)
end

#gsub(re, arg) ⇒ Object



174
175
176
# File 'lib/rio/ops/path.rb', line 174

def gsub(re,arg)
  new_rio(softreset.to_s.gsub(re,arg.to_s))
end

#normalizeObject



131
132
133
134
135
# File 'lib/rio/ops/path.rb', line 131

def normalize
  rtn_rio {
    uri.normalize
  }
end

#splitpathObject



145
146
147
148
149
150
151
152
153
# File 'lib/rio/ops/path.rb', line 145

def splitpath()
  require 'rio/to_rio'
  sparts,bparts = self.rl.split
  parts = []
  (0...sparts.length).each do |n|
    parts << new_rio(sparts[n], {:base => bparts[n]})
  end
  parts.extend(ToRio::Array)
end

#sub(re, arg) ⇒ Object



168
169
170
171
172
173
# File 'lib/rio/ops/path.rb', line 168

def sub(re,arg)
  rtn_rio { 
    softreset
    uri.ref.sub(re,arg.to_s)
  }
end