What is the fastest, most optimized, one-liner way to get an array of the directories (excluding files) in Ruby?
How about including files?
Dir.glob("**/*/") # for directories
Dir.glob("**/*") # for all files
Instead of Dir.glob(foo)
you can also write Dir[foo]
(however Dir.glob
can also take a block, in which case it will yield each path instead of creating an array).