Extract a partial path from the path. Includen directories from
the front end (left hand side) if n is positive. Include |n| directories from
the back end (right hand side) if n is negative.
# File lib/rake/ext/string.rb, line 38
def pathmap_partial(n)
dirs = File.dirname(self).pathmap_explode
partial_dirs =
if n > 0
dirs[0...n]
elsif n < 0
dirs.reverse[0...-n].reverse
else
"."
end
File.join(partial_dirs)
end