lib/rio/ops/path.rb in rio-0.5.1 vs lib/rio/ops/path.rb in rio-0.6.0
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===========================================================================
-# Copyright (c) 2005-2012 Christopher Kleckner
+# Copyright (c) 2005-2017 Christopher Kleckner
# All rights reserved
#
# This file is part of the Rio library for ruby.
#
# Rio is free software; you can redistribute it and/or modify
@@ -22,11 +22,10 @@
#++
#
require 'rio/fwd'
-#require 'rio/impl/path'
require 'rio/ops/create'
require 'rio/ops/construct'
module RIO
module Ops
module Path
@@ -83,24 +82,18 @@
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
def absolute?
- #p "ops/path.rb absolute?"
rl.absolute?
end
alias :abs? :absolute?
- #def abs?
- # p "ops/path.rb abs?"
- # rl.abs?
- #end
def route_from(other)
this_uri = rl.uri.abs
other_uri = ensure_rio(other).rl.uri.abs
new_rio(this_uri.route_from(other_uri))
end
@@ -119,18 +112,16 @@
end
def merge(other)
new_rio(rl.merge(ensure_rio(other).rl))
end
def base()
- #p "BASE: " + rl.class.to_s
new_rio(rl.base())
end
def setbase(b)
rl.base(b)
self
end
- extend Forwardable
extend Fwd
fwd :rl,:scheme,:host,:user,:password
fwd :rl,:query,:fragment,:userinfo
fwd :rl,:typecode
fwd :rl,:authority
@@ -157,16 +148,10 @@
parts = []
(0...sparts.length).each do |n|
parts << new_rio(sparts[n], {:base => bparts[n]})
end
parts.extend(ToRio::Array)
- #parts.each do |part|
- # p "part=#{part.uri} abs=#{part.abs.uri}"
- #end
- # map to rios and extend the array with to_array
- #parts.map { |arl| new_rio(arl) }.extend(ToRio::Array)
- #parts.map { |arl| new_rio(arl) }
end
def basename(*args)
unless args.empty?
ex = args[0] || self.extname
self.ext(ex)
@@ -183,11 +168,10 @@
def sub(re,arg)
rtn_rio {
softreset
uri.ref.sub(re,arg.to_s)
}
- #new_rio(softreset.to_s.sub(re,arg.to_s))
end
def gsub(re,arg)
new_rio(softreset.to_s.gsub(re,arg.to_s))
end
@@ -290,10 +274,9 @@
dst = self.ensure_rio(d)
dst /= self.filename if dst.directory?
if self.abs?
fs.symlink(self,dst)
else
- #p "symlink(#{dst.route_to(self)},#{dst})"
fs.symlink(dst.route_to(self).to_s,dst.to_s)
end
dst.reset
}
end