Method: Path#descend
- Defined in:
- lib/epath/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 actual filesystem.
102 103 104 105 106 |
# File 'lib/epath/parts.rb', line 102 def descend return to_enum(:descend) unless block_given? ascend.reverse_each { |v| yield v } nil end |