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.


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

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


62
63
64
# File 'middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb', line 62

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