class Middleman::PreviewServer::BasicInformation
Basic information class to wrap common behaviour
Attributes
Public Class Methods
Source
# File lib/middleman-core/preview_server/information.rb, line 30 def initialize(opts={}) @bind_address = ServerIpAddress.new(opts[:bind_address]) @server_name = ServerHostname.new(opts[:server_name]) @port = opts[:port] @valid = true @site_addresses = [] @listeners = [] @checks = [] # This needs to be check for each use case. Otherwise `Webrick` will # complain about that. @checks << Checks::InterfaceIsAvailableOnSystem.new end
Create instance
@param [String] bind_address
The bind address of the server
@param [String] server_name
The name of the server
@param [Integer] port
The port to listen on
Public Instance Methods
Source
# File lib/middleman-core/preview_server/information.rb, line 71 def local_network_interfaces network_interfaces_inventory.nil? ? [] : network_interfaces_inventory.network_interfaces(:all) end
Default is to get all network interfaces
Source
# File lib/middleman-core/preview_server/information.rb, line 58 def resolve_me(*) fail NoMethodError end
Source
# File lib/middleman-core/preview_server/information.rb, line 66 def show_me_network_interfaces(inventory) @network_interfaces_inventory = inventory end
Get network information
@param [#network_interfaces] inventory
Get list of available network interfaces
Source
# File lib/middleman-core/preview_server/information.rb, line 46 def valid? valid == true end
Is the given information valid?
Source
# File lib/middleman-core/preview_server/information.rb, line 54 def validate_me(validator) validator.validate self, checks end
Pass “self” to validator
@param [#validate] validator
The validator