Module: RIO::Ops::Path::Change

Included in:
Path::Str
Defined in:
lib/rio/ops/path.rb

Instance Method Summary collapse

Instance Method Details

#basename=(arg) ⇒ Object



213
214
215
216
217
218
219
220
# File 'lib/rio/ops/path.rb', line 213

def basename=(arg)
  if cx['rename']
    must_exist.basename = arg
  else
    rl.urlpath = _path_with_basename(arg)
    softreset
  end
end

#dirname=(arg) ⇒ Object



233
234
235
236
237
238
239
240
# File 'lib/rio/ops/path.rb', line 233

def dirname=(arg)
  if cx['rename']
    must_exist.dirname = arg
  else
    rl.path = _path_with_dirname(arg)
    softreset
  end
end

#extname=(arg) ⇒ Object



222
223
224
225
226
227
228
229
230
231
# File 'lib/rio/ops/path.rb', line 222

def extname=(arg)
  #p callstr('extname=',arg)
  
  if cx['rename']
    must_exist.extname = arg
  else
    rl.urlpath = _path_with_ext(arg)
    softreset
  end
end

#filename=(arg) ⇒ Object



204
205
206
207
208
209
210
211
# File 'lib/rio/ops/path.rb', line 204

def filename=(arg)
  if cx['rename']
    must_exist.filename = arg
  else
    rl.urlpath = _path_with_filename(arg)
    softreset
  end
end

#norename(arg = false, &block) ⇒ Object



202
# File 'lib/rio/ops/path.rb', line 202

def norename(arg=false,&block) nocxx('rename',&block) end

#rename(*args, &block) ⇒ Object



192
193
194
195
196
197
198
199
200
# File 'lib/rio/ops/path.rb', line 192

def rename(*args,&block)
  if args.empty?
    cxx('rename',true,&block)
  else
    rtn = must_exist.rename(*args)
    return rtn.each(&block) if block_given?
    rtn
  end
end

#rename?Boolean

Returns:

  • (Boolean)


201
# File 'lib/rio/ops/path.rb', line 201

def rename?() cxx?('rename') end

#sub!(*args) ⇒ Object



187
188
189
190
# File 'lib/rio/ops/path.rb', line 187

def sub!(*args)
  rl.path = rl.path.sub(*args)
  softreset
end