Class: RhoDevelopment::Network

Inherits:
Object
  • Object
show all
Defined in:
lib/build/development/network.rb

Overview

Returns available network interfaces

Class Method Summary collapse

Class Method Details

.available_addressesArray

Returns array with available network interfaces on the machine. IPV6, loopback and multicast interfaces are excepted.

Returns:

  • (Array)

    array with available IP4V network interfaces.



9
10
11
12
# File 'lib/build/development/network.rb', line 9

def self.available_addresses
  addresses = (Socket.ip_address_list.select { |each| each.ipv4? and !each.ipv4_loopback? and !each.ipv4_multicast? }.map { |each| each.ip_address }.uniq)
  return addresses
end