Close the directory object with the Dir.foreach method

This commit is contained in:
dearblue
2022-12-25 21:25:30 +09:00
parent a6e456e72e
commit 50b24c124f
+3 -1
View File
@@ -25,7 +25,9 @@ class Dir
alias children entries
def foreach(path, &block)
self.open(path).each(&block)
self.open(path) do |d|
d.each(&block)
end
end
def open(path, &block)