有没有一个更清洁的方法来做这件事?
ree> Pathname.new('/path/to').children.select{|e| e.directory?}.map{|d| d.basename.to_s}
=> ["test1", "test2"]
理想情况下,我想避免calldirectory?
发布于 2018-03-21 15:44:34
Pathname.glob("/path/to/*/").map { |i| i.basename.to_s }
https://stackoverflow.com/questions/-100003657
复制相似问题