Class: Middleman::PreviewServer::ServerNameIsIpInformation

Inherits:
BasicInformation show all
Defined in:
lib/middleman-core/preview_server/information.rb

Overview

If the server name is either an ipv4 or ipv6 address, e.g. 127.0.0.1 or ::1, use this one

Instance Attribute Summary

Attributes inherited from BasicInformation

#bind_address, #listeners, #port, #reason, #server_name, #site_addresses, #valid

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicInformation

#local_network_interfaces, #show_me_network_interfaces, #valid?, #validate_me

Constructor Details

#initialize(opts = {}) ⇒ ServerNameIsIpInformation

Returns a new instance of ServerNameIsIpInformation.



253
254
255
256
257
258
259
260
# File 'lib/middleman-core/preview_server/information.rb', line 253

def initialize(opts={})
  super

  ip = ServerIpAddress.new(server_name.to_s)

  @listeners << ip
  @site_addresses << ip
end

Class Method Details

.matches?(opts = {}) ⇒ Boolean

Returns:

  • (Boolean)


264
265
266
267
268
269
270
# File 'lib/middleman-core/preview_server/information.rb', line 264

def self.matches?(opts={})
  ip = IPAddr.new(opts[:server_name])

  ip.ipv4? || ip.ipv6?
rescue
  false
end

Instance Method Details

#resolve_meObject



262
# File 'lib/middleman-core/preview_server/information.rb', line 262

def resolve_me(*); end