Class: Middleman::PreviewServer::NetworkInterfaceInventory::Ipv4

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

Overview

Return all ipv4 interfaces

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(type) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/middleman-core/preview_server/network_interface_inventory.rb', line 27

def self.match?(type)
  :ipv4 == type
end

Instance Method Details

#network_interfacesObject



23
24
25
# File 'lib/middleman-core/preview_server/network_interface_inventory.rb', line 23

def network_interfaces
  Socket.ip_address_list.select { |ai| ai.ipv4? && !ai.ipv4_loopback? }.map { |ai| ServerIpv4Address.new(ai.ip_address) }
end