We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec11fb1 commit 3a07050Copy full SHA for 3a07050
1 file changed
pathname_builtin.rb
@@ -766,15 +766,12 @@ def join(*args)
766
#
767
def children(with_directory=true)
768
with_directory = false if @path == '.'
769
- result = []
770
- Dir.foreach(@path) {|e|
771
- next if e == '.' || e == '..'
772
- if with_directory
773
- result << self.class.new(File.join(@path, e))
774
- else
775
- result << self.class.new(e)
776
- end
777
- }
+ result = Dir.children(@path)
+ if with_directory
+ result.map! {|e| self.class.new(File.join(@path, e))}
+ else
+ result.map! {|e| self.class.new(e)}
+ end
778
result
779
end
780
0 commit comments