Class: Middleman::PreviewServer::ServerIpv6Address

Inherits:
BasicServerIpAddress show all
Defined in:
lib/middleman-core/preview_server/server_ip_address.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(str) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
# File 'lib/middleman-core/preview_server/server_ip_address.rb', line 38

def self.match?(str)
  str = str.to_s.sub(/%.*$/, '')
  IPAddr.new(str).ipv6?
rescue IPAddr::InvalidAddressError, IPAddr::AddressFamilyError
  false
end

Instance Method Details

#to_browserObject



34
35
36
# File 'lib/middleman-core/preview_server/server_ip_address.rb', line 34

def to_browser
  format('[%s]', to_s)
end

#to_sObject



30
31
32
# File 'lib/middleman-core/preview_server/server_ip_address.rb', line 30

def to_s
  __getobj__.sub(/%.*$/, '')
end