method
foreach
ruby latest stable - Class:
Pathname
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_9_1_378) is shown here.
foreach(*args, &block)public
This method is obsoleted at 1.8.1. Use #each_line or #each_entry.
# File lib/pathname.rb, line 1075
def foreach(*args, &block)
warn "Pathname#foreach is obsoleted. Use each_line or each_entry."
if FileTest.directory? @path
# For polymorphism between Dir.foreach and IO.foreach,
# Pathname#foreach doesn't yield Pathname object.
Dir.foreach(@path, *args, &block)
else
IO.foreach(@path, *args, &block)
end
end