diff options
Diffstat (limited to 'ext/pathname')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 90485a2783..4909c2dc23 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -489,6 +489,8 @@ class Pathname # * Find * # Pathname#find is an iterator to traverse a directory tree in a depth first # manner. It yields a Pathname for each file under "this" directory. # + # Returns an enumerator if no block is given. + # # Since it is implemented by <tt>find.rb</tt>, <tt>Find.prune</tt> can be used # to control the traversal. # @@ -496,6 +498,7 @@ class Pathname # * Find * # current directory, not <tt>./</tt>. # def find # :yield: pathname + return to_enum(__method__) unless block_given? require 'find' if @path == '.' Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) } |