mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-dir/dir.rb: simplify loop delegation
This commit is contained in:
@@ -21,11 +21,7 @@ class Dir
|
||||
end
|
||||
|
||||
def foreach(path, &block)
|
||||
if block
|
||||
self.open(path).each {|f| block.call(f) }
|
||||
else
|
||||
self.open(path).each
|
||||
end
|
||||
self.open(path).each(&block)
|
||||
end
|
||||
|
||||
def open(path, &block)
|
||||
|
||||
Reference in New Issue
Block a user