def relative_path_from(base)
base = self.class.for(base)
raise ArgumentError, 'no relative path between a relative and absolute' if self.absolute? != base.absolute?
return self if base.dot?
return self.class.new(DOT) if self == base
base = base.cleanpath.to_a
dest = self.cleanpath.to_a
while !dest.empty? && !base.empty? && dest[0] == base[0]
base.shift
dest.shift
end
base.shift if base[0] == DOT
dest.shift if dest[0] == DOT
raise ArgumentError, "base directory may not contain '#{DOT_DOT}'" if base.include?(DOT_DOT)
path = base.fill(DOT_DOT) + dest
path = self.class.join(*path)
path = self.class.new(DOT) if path.empty?
path
end