Method: Pathname#find_dirs
- Defined in:
- lib/pleasant_path/pathname.rb
#find_dirs {|descendent| ... } ⇒ self #find_dirs ⇒ Enumerator<Pathname>
Iterates over all (recursive) descendent directories of the directory indicated by the Pathname. Iterated Pathnames are prefixed by the original Pathname, and are in depth-first order.
If a block is given, each descendent Pathname is yielded, and this method returns the original Pathname. Otherwise, an Enumerator is returned.
149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/pleasant_path/pathname.rb', line 149 def find_dirs return to_enum(__method__) unless block_given? self.find do |path| if path.file? Find.prune elsif path != self yield path end end self end |