lib/web_test/util.rb in rspec-webservice_matchers-4.12.0 vs lib/web_test/util.rb in rspec-webservice_matchers-4.12.1
- old
+ new
@@ -78,9 +78,19 @@
else
"http://#{url_or_domain_name}"
end
end
+ # Return just the domain name portion of a URL if
+ # it's simply of the form http://name.tld
+ def self.make_domain_name(url_or_domain_name)
+ if %r{^https?://(.+)} =~ url_or_domain_name
+ $1
+ else
+ url_or_domain_name
+ end
+ end
+
# Normalize the input: remove 'http(s)://' if it's there
def self.remove_protocol(domain_name_or_url)
%r{^https?://(?<name>.+)$} =~ domain_name_or_url
name || domain_name_or_url
end