mruby-dir/dir.rb: reformat according to coding standard
@@ -9,17 +9,18 @@ class Dir
alias pos tell
alias pos= seek
- def self.entries(path)
+ class << self
+ def entries(path)
a = []
- self.open(path) { |d|
+ self.open(path) do |d|
while s = d.read
a << s
end
- }
+ end
a
end
- def self.foreach(path, &block)
+ def foreach(path, &block)
if block
self.open(path).each {|f| block.call(f) }
else
@@ -27,7 +28,7 @@ class Dir
end
end
- def self.open(path, &block)
+ def open(path, &block)
if block
d = self.new(path)
begin
@@ -40,7 +41,7 @@ class Dir
end
end
- def self.chdir(path, &block)
+ def chdir(path, &block)
my = self # workaround for https://github.com/mruby/mruby/issues/1579
if block
wd = self.getwd
@@ -55,7 +56,6 @@ class Dir
end
end
- class << self
alias exists? exist?
alias pwd getwd
alias rmdir delete
