Method: Path#descend

Defined in:
lib/path/parts.rb

#descend {|path| ... } ⇒ Object

Iterates over each element in the given path in descending order.

Path.new('/path/to/some/file.rb').descend { |v| p v }
   #<Path />
   #<Path /path>
   #<Path /path/to>
   #<Path /path/to/some>
   #<Path /path/to/some/file.rb>

Path.new('path/to/some/file.rb').descend { |v| p v }
   #<Path path>
   #<Path path/to>
   #<Path path/to/some>
   #<Path path/to/some/file.rb>

It doesn’t access the filesystem.

Yield Parameters:



114
115
116
117
118
# File 'lib/path/parts.rb', line 114

def descend
  return to_enum(:descend) unless block_given?
  ascend.reverse_each { |v| yield v }
  nil
end