APIdock / Ruby
/
method

find

ruby latest stable - Class: Pathname
find(ignore_error: true)
public

Iterates over the directory tree in a depth first manner, yielding a Pathname for each file under "this" directory.

Returns an Enumerator if no block is given.

Since it is implemented by the standard library module Find, Find.prune can be used to control the traversal.

If self is ., yielded pathnames begin with a filename in the current directory, not ./.

See Find.find

# File ext/pathname/lib/pathname.rb, line 559
 def find(ignore_error: true) # :yield: pathname
 return to_enum(__method__, ignore_error: ignore_error) unless block_given?
 require 'find'
 if @path == '.'
 Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.sub(%{\A\./}, '')) }
 else
 Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f) }
 end
 end

AltStyle によって変換されたページ (->オリジナル) /