I'm trying to take an array like
[ "First.Package", "Second.Package" ]
and turn it into
[ "First.Package.ads", "First.Package.adb", "Second.Package.ads", "Second.Package.adb" ]
I've tried doing the following:
packages = [ "First.Package", "Second.Package" ]
files = []
packages.each do |package|
files << (package << ".ads")
files << (package << ".adb")
end
return files
Which does not do what I think it should do. I get:
First.Package.ads.adb
First.Package.ads.adb
Second.Package.ads.adb
Second.Package.ads.adb
I want:
First.Package.ads
First.Package.adb
Second.Package.ads
Second.Package.adb
arr.flat_map { |str| [str+".ads",str+".adb"] }