mruby-dir/dir.rb: make each_child as an alias to each

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-12-22 00:02:33 +09:00
parent 3d6a4c39bf
commit ca3b694efe
+3 -2
View File
@@ -1,11 +1,12 @@
class Dir
def each_child(&block)
def each(&block)
while s = self.read
block.call(s)
end
self
end
alias each_child each
alias pos tell
alias pos= seek
@@ -22,7 +23,7 @@ class Dir
alias children entries
def foreach(path, &block)
self.open(path).each_child(&block)
self.open(path).each(&block)
end
def open(path, &block)