开发者

Ruby dir path exclude directory from path

开发者 https://www.devze.com 2023-04-11 20:41 出处:网络
now i\'m importing this directory Dir[\"#{Rails.root}/app/{views,controllers}/**/**/**/**\"] but i want to exclude one directory in a specified position

now i'm importing this directory

Dir["#{Rails.root}/app/{views,controllers}/**/**/**/**"]

but i want to exclude one directory in a specified position

Dir["#{Rails.root}/app/{views,controllers}/#All dir开发者_运维技巧ectory but exclude 'admin'#/**/**/**"]

any help?


try

Dir["#{Rails.root}/app/{views,controllers}/**/**/**/**"].reject { |f| f["#{Rails.root}/app/{views,controllers}/admin/"]}
0

精彩评论

暂无评论...
验证码 换一张
取 消