#should_download = actions.empty? || (actions.include? "download") # old line of code
# new lines of code:
should_download = false
server_preference = "goog" # Default to google
unless actions.empty?
actions.each do |action| # Actions is an array of launch options, ex: ["download-goog", "unzip", "extract"]
should_download = !(action.match /download/).nil? # is there a better way to evaluate false to nil and true to not nil?
if should_download # break once the download option has been found
server_preference = action.match(/goog|reed/).to_s # Sets server preference to "goog" or "reed" dependent on dl suffix
break
end
end
end
No comments:
Post a Comment