Ruby/File Directory/Dir.reject
Материал из Wiki.crossplatform.ru
Get all contents other than ".", "..", and hidden files.
d = Dir.open("mydir") d.reject { |f| f[0] == "." } d.close
Get the names of all files in the directory.
d = Dir.open("mydir") d.reject { |f| f[0] == "." } d.rewind d.reject { |f| !File.file? File.join(d.path, f) } d.close