mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #5876 from dearblue/dir-foreach
Close the directory object with the `Dir.foreach` method
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user