Issue #8269 has been updated by zzak (Zachary Scott).

Category set to lib
Status changed from Open to Feedback

I think this is out of the scope of find.rb, see "find.rb: the Find module for processing all files under a given directory."

If you want this feature, I think you should write a gem.
----------------------------------------
Feature #8269: stdlib: Add Find.each_file to accompany Find.find
https://bugs.ruby-lang.org/issues/8269#change-39630

Author: tommylommykins (Thomas Green)
Status: Feedback
Priority: Normal
Assignee: 
Category: lib
Target version: 


Often when I use the find module, I am only interested in files.
Since Find.find returns files and directories, I often write code
that looks like this:

Find.find('foo/bar') do |f|
 next if File.directory? f

 code code code ...
end


To remove the test for directories, a class method, called find.each_file
could be added, which would only yield files.


module Find
  def self.each_file(*paths)
    block_given? or return enum_for(__method__, *paths)
    self.find(*paths) {|f yield f unless File.directory? f}
  end
end 



-- 
http://bugs.ruby-lang.org/