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



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

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

#basename(*args) ⇒ Object



142
143
144
145
146
147
148
# File 'lib/rio/ops/path.rb', line 142

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



152
153
154
# File 'lib/rio/ops/path.rb', line 152

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

#expand_path(*args) ⇒ Object



128
129
130
131
# File 'lib/rio/ops/path.rb', line 128

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

#extname(*args) ⇒ Object



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

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

#filenameObject



149
150
151
# File 'lib/rio/ops/path.rb', line 149

def filename()
  new_rio(rl.filename)
end

#gsub(re, arg) ⇒ Object



159
160
161
# File 'lib/rio/ops/path.rb', line 159

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

#splitpathObject



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

def splitpath()
  require 'rio/to_rio'
  parts = self.rl.split
  # map to rios and extend the array with to_array
  parts.map { |arl| new_rio(arl) }.extend(ToRio::Array)
end

#sub(re, arg) ⇒ Object



156
157
158
# File 'lib/rio/ops/path.rb', line 156

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