From ebf45da742e0dc0dbf58071b1096045bb81202c8 Mon Sep 17 00:00:00 2001 From: ethicalhack3r Date: Sun, 21 Oct 2012 01:43:50 +0200 Subject: [PATCH] Turned add_http_protocol & add_trailing_slash methods into ternary operators. --- lib/common_helper.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/common_helper.rb b/lib/common_helper.rb index 99deb549..9bda916c 100644 --- a/lib/common_helper.rb +++ b/lib/common_helper.rb @@ -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