Class: Middleman::PreviewServer::NetworkInterfaceInventory

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

Overview

This holds information about local network interfaces on the user systemd

Defined Under Namespace

Classes: All, Ipv4, Ipv6

Instance Method Summary collapse

Constructor Details

#initializeNetworkInterfaceInventory

Returns a new instance of NetworkInterfaceInventory.



49
50
51
52
53
54
# File 'middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb', line 49

def initialize
  @types = []
  @types << Ipv4
  @types << Ipv6
  @types << All
end

Instance Method Details

#network_interfaces(type = :all) ⇒ Object

Return ip interfaces

Parameters:

  • type (Symbol) (defaults to: :all)

    The type of interface which should be returned



60
61
62
# File 'middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb', line 60

def network_interfaces(type=:all)
  types.find { |t| t.match? type.to_sym }.new.network_interfaces
end