How do I append a value to each array item?
I have this code, it works but it just doesn't look right. I'm creating开发者_Python百科 a string that I'm passing to the server through SSH:
... chmod -R 777 #{remote_path}/#{project}/#{items_to_chmod.join(' ' + remote_path + '/' + project + '/')} ...
The ugly thing is the first "#{remote_path}/#{project}/"
, it's not being added to the first item value in the array.
How about this?
"... chmod -R 777 #{ items_to_chmod.map{ |item| File.join(remote_path, project, item) }.join(" ") } ..."
精彩评论