I am parsing keywords from a string and wondering if there is an alternative method other than massive if-then-else statements or using a switch statement. Any direction would be helpful
application = application.downcase
if(application.include?("ssl"))
return "SSL"
elsif(application.include?("ssh"))
return "SSH"
elsif(application.include?("dce"))
return "DCE"
elsif(application.include?("https"))
return "HTTPS"
elsif(application.include?("https"))
return "http"
else
return "nil"
Aucun commentaire:
Enregistrer un commentaire