Class: Middleman::PreviewServer::ServerInformationCallbackProxy

Inherits:
Object
  • Object
show all
Defined in:
middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb

Overview

This class wraps server information to be used in call back

  • listeners
  • port
  • server name
  • site_addresses

All information is "dupped" and the callback is not meant to be used to modify these information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_information) ⇒ ServerInformationCallbackProxy

Returns a new instance of ServerInformationCallbackProxy



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb', line 15

def initialize(server_information)
  @listeners = ServerUrl.new(
    hosts: server_information.listeners,
    port: server_information.port,
    https: server_information.https?,
    format_output: false
  ).to_bind_addresses

  @port           = server_information.port
  @server_name    = server_information.server_name.dup unless server_information.server_name.nil?

  @site_addresses = ServerUrl.new(
    hosts: server_information.site_addresses,
    port: server_information.port,
    https: server_information.https?,
    format_output: false
  ).to_urls
end

Instance Attribute Details

#listenersObject (readonly)

Returns the value of attribute listeners



13
14
15
# File 'middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb', line 13

def listeners
  @listeners
end

#portObject (readonly)

Returns the value of attribute port



13
14
15
# File 'middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb', line 13

def port
  @port
end

#server_nameObject (readonly)

Returns the value of attribute server_name



13
14
15
# File 'middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb', line 13

def server_name
  @server_name
end

#site_addressesObject (readonly)

Returns the value of attribute site_addresses



13
14
15
# File 'middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb', line 13

def site_addresses
  @site_addresses
end