Turned add_http_protocol & add_trailing_slash methods into ternary operators.

This commit is contained in:
ethicalhack3r
2012-10-21 01:43:50 +02:00
parent ea77b431da
commit ebf45da742

View File

@@ -40,15 +40,11 @@ end
# Add protocol
def add_http_protocol(url)
if url !~ /^https?:/
url = "http://#{url}"
end
url
url =~ /^https?:/ ? url : "http://#{url}"
end
def add_trailing_slash(url)
url = "#{url}/" if url !~ /\/$/
url
url =~ /\/$/ ? url : "#{url}/"
end
# Gets the string all elements in stringarray ends with