vendor/bundle/ruby/2.7.0/gems/github-pages-health-check-1.17.0/lib/github-pages-health-check/domain.rb
# Parse the URI. Accept either domain names or full URI's.
# Used by the initializer so we can be more flexible with inputs.
#
# domain - a URI or domain name.
#
# Examples
#
#   normalize_host("benbalter.github.com")
#   # => 'benbalter.github.com'
#   normalize_host("https://benbalter.github.com")
#   # => 'benbalter.github.com'
#   normalize_host("benbalter.github.com/help-me-im-a-path/")
#   # => 'benbalter.github.com'
#
# Return the hostname.
Parse the URI. Accept either domain names or full URI's.
Used by the initializer so we can be more flexible with inputs.

a URI or domain name.

Examples



Return the hostname.
Parse the URI . Accept either domain names or full URI ' s . Used by the initializer so we can be more flexible with inputs . a URI or domain name . Examples Return the hostname .
def normalize_host(domain)
        domain = domain.strip.chomp(".")
        host = Addressable::URI.parse(domain).normalized_host
        host ||= Addressable::URI.parse("http://#{domain}").normalized_host
        host unless host.to_s.empty?
      rescue Addressable::URI::InvalidURIError
        nil
      end
def normalize_host ( domain ) domain = domain . strip . chomp ( "." ) host = Addressable :: URI . parse ( domain ) . normalized_host host ||= Addressable :: URI . parse ( "http://#{domain}" ) . normalized_host host unless host . to_s . empty? rescue Addressable :: URI :: InvalidURIError nil end
Parse the URI.
Parse the URI .
domain
<not_specific>