lib/core/facets/dir/ascend.rb in facets-2.8.4 vs lib/core/facets/dir/ascend.rb in facets-2.9.0.pre.1

- old
+ new

@@ -2,20 +2,18 @@ # TODO: Make instance method versions ? # Ascend a directory path. # + # a = [] + # # Dir.ascend("/var/log") do |path| - # p path + # a << path # end # - # _produces_ + # a #=> ['/var/log', '/var', '/'] # - # /var/log - # /var - # / - # # CREDIT: Daniel Berger, Jeffrey Schwab # # TODO: make it work with windows too # use FileTest.root? @@ -33,18 +31,16 @@ end end # Descend a directory path. # + # d = [] + # # Dir.descend("/var/log") do |path| - # p path + # d << path # end # - # _produces_ - # - # / - # /var - # /var/log + # d #=> ['/', '/var', '/var/log'] # # CREDIT: Daniel Berger, Jeffrey Schwab def self.descend(path) #:yield: paths = path.split('/')