class FakeFS::Pathname

def ascend


This method is available since 1.8.5.

It doesn't access actual filesystem.

#
#
#
#
Pathname.new('path/to/some/file.rb').ascend { |v| p v}

#
#
#
#
#
Pathname.new('/path/to/some/file.rb').ascend { |v| p v}

for each element in the given path in ascending order.
Iterates over and yields a new Pathname object
def ascend
  path = @path
  yield self
  while (r = chop_basename(path))
    path, _name = r
    break if path.empty?
    yield self.class.new(del_trailing_separator(path))
  end
end