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 # Add protocol
def add_http_protocol(url) def add_http_protocol(url)
if url !~ /^https?:/ url =~ /^https?:/ ? url : "http://#{url}"
url = "http://#{url}"
end
url
end end
def add_trailing_slash(url) def add_trailing_slash(url)
url = "#{url}/" if url !~ /\/$/ url =~ /\/$/ ? url : "#{url}/"
url
end end
# Gets the string all elements in stringarray ends with # Gets the string all elements in stringarray ends with