Turned add_http_protocol & add_trailing_slash methods into ternary operators.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user