Sha256: a693449613cbd3a3ca06027d2abe4fafacdd21ad1043dcab23bc53ff9eb90d12
Contents?: true
Size: 450 Bytes
Versions: 28
Compression:
Stored size: 450 Bytes
Contents
require 'pathname' class Pathname # Already included in 1.8.4+ version of Ruby if ! instance_methods.include?(:descend) # Calls the _block_ for every successive subdirectory of the # directory path from the root (absolute path) unitl +.+ # (relative path) is reached. def descend() @path.scan(%r{[^/]*/?})[0...-1].inject('') do |path, dir| yield Pathname.new(path << dir) path end end end end
Version data entries
28 entries across 28 versions & 2 rubygems