Method: Pathname#find_files

Defined in:
lib/pleasant_path/pathname.rb

#find_files {|descendent| ... } ⇒ self #find_filesEnumerator<Pathname>

Iterates over all (recursive) descendent files 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.

Overloads:

  • #find_files {|descendent| ... } ⇒ self

    Yield Parameters:

    Returns:

    • (self)
  • #find_filesEnumerator<Pathname>

    Returns:

See Also:



225
226
227
228
229
230
231
232
233
# File 'lib/pleasant_path/pathname.rb', line 225

def find_files
  return to_enum(__method__) unless block_given?

  self.find do |path|
    yield path if path.file?
  end

  self
end