Class: Middleman::PreviewServer::ServerNameInformation
- Inherits:
-
BasicInformation
- Object
- BasicInformation
- Middleman::PreviewServer::ServerNameInformation
- Defined in:
- middleman-core/lib/middleman-core/preview_server/information.rb
Overview
Use if server name is given and bind address is blank
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
-
#initialize(*args) ⇒ ServerNameInformation
constructor
A new instance of ServerNameInformation.
- #resolve_me(resolver) ⇒ Object
Methods inherited from BasicInformation
#local_network_interfaces, #show_me_network_interfaces, #valid?, #validate_me
Constructor Details
#initialize(*args) ⇒ ServerNameInformation
Returns a new instance of ServerNameInformation.
207 208 209 210 211 212 |
# File 'middleman-core/lib/middleman-core/preview_server/information.rb', line 207 def initialize(*args) super @checks << Checks::RequiresBindAddressIfServerNameIsGiven.new @site_addresses << server_name end |
Class Method Details
.matches?(opts = {}) ⇒ Boolean
225 226 227 |
# File 'middleman-core/lib/middleman-core/preview_server/information.rb', line 225 def self.matches?(opts={}) opts[:bind_address].blank? && !opts[:server_name].blank? end |
Instance Method Details
#resolve_me(resolver) ⇒ Object
214 215 216 217 218 219 220 221 222 223 |
# File 'middleman-core/lib/middleman-core/preview_server/information.rb', line 214 def resolve_me(resolver) @bind_address = ServerIpAddress.new(resolver.ips_for(server_name).first) unless bind_address.blank? @listeners << bind_address @site_addresses << bind_address end self end |