config/initializers/1_settings.rb
# Extract the host part of the given +url+.
Extract the host part of the given +url+.
Extract the host part of the given + url + .
def host(url)
      url = url.downcase
      url = "http://#{url}" unless url.start_with?('http')
      url_without_path = url.sub(%r{(https?://[^/]+)/?.*}, '\1')
      URI.parse(url_without_path).host
    end
def host ( url ) url = url . downcase url = "http://#{url}" unless url . start_with? ( 'http' ) url_without_path = url . sub ( %r{ (https?://[^/]+)/?.* } , '\1' ) URI . parse ( url_without_path ) . host end
Extract the host part of the given +url+.
Extract the host part of the given + url + .
# Get rid of the path so that we don't even have to encode it
url
<not_specific>