Class: Storexplore::UriUtils
- Inherits:
-
Object
- Object
- Storexplore::UriUtils
- Defined in:
- lib/storexplore/uri_utils.rb
Overview
Extra URI utilities
Class Method Summary collapse
-
.domain(uri) ⇒ Object
extracts the domain from an uri.
Class Method Details
.domain(uri) ⇒ Object
extracts the domain from an uri
29 30 31 32 33 34 35 36 |
# File 'lib/storexplore/uri_utils.rb', line 29 def self.domain(uri) return "localhost" if uri.scheme == "file" return nil if uri.host.nil? return nil if uri.host =~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ /([^\.]+\.[^\.]+)$/.match(uri.host)[0] end |