I'm looping over some files, and need to skip files that have a certain substring in their path. These substrings are defined as an array. For example:
Dir.glob("#{temp_dir}/**/*").each do |file|
# Skip files in the ignore list
if (file.downcase.index("__macosx"))
next
end
puts file
end
The code above successfully skips any file path with __macosx, but I need to adapt it to work with an array of substrings, something like the following:
if (file.downcase.index(["__macosx", ".ds_store"]))
next
end
How can I do that, while avoiding having to write an extra loop to iterate over the substring array?