Methods
Public Instance methods
Calls the block for every successive parent directory of the directory path until the root (absolute path) or +.+ (relative path) is reached.
[ show source ]
# File lib/facets/core/pathname/ascend.rb, line 11 def ascend(inclusive=false,&block) # :yield: cur_dir = self yield( cur_dir.cleanpath ) if inclusive until cur_dir.root? or cur_dir == Pathname.new(".") cur_dir = cur_dir.parent yield cur_dir end end
Calls the block for every successive subdirectory of the directory path from the root (absolute path) unitl +.+ (relative path) is reached.
[ show source ]
# File lib/facets/core/pathname/descend.rb, line 11 def descend() @path.scan(%r{[^/]*/?})[0...-1].inject('') do |path, dir| yield Pathname.new(path << dir) path end end