Вопрос не ясен.
Я предполагаю, что массив будет выглядеть так:
array = [
"/uploads/content/attachment/folder/file1.pdf/file2.pdf/file3.pdf",
"/uploads/content/attachment/folder/file12.pdf/file23.pdf/fildf34.pdf",
"/foo/boo/folder/file1.doc/file2.docx/file11.pdf"
]
Он разбивает ссылки для folder/
links = array.map{ |a| a.split('folder/') }.flat_map do |path, files|
files.split('/').map{ |file| path + "folder/" + file }
end
p links
#=> [
"/uploads/content/attachment/folder/file1.pdf",
"/uploads/content/attachment/folder/file2.pdf",
"/uploads/content/attachment/folder/file3.pdf",
"/uploads/content/attachment/folder/file12.pdf",
"/uploads/content/attachment/folder/file23.pdf",
"/uploads/content/attachment/folder/fildf34.pdf",
"/foo/boo/folder/file1.doc",
"/foo/boo/folder/file2.docx",
"/foo/boo/folder/file11.pdf"
]