Class: SwissAdmin::Network

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

Class Method Summary collapse

Class Method Details

.first_ipv4Object



9
10
11
# File 'lib/swiss_admin/network/network.rb', line 9

def self.first_ipv4
  Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address
end

.ip_addressesObject



5
6
7
# File 'lib/swiss_admin/network/network.rb', line 5

def self.ip_addresses
  Socket.ip_address_list.map { |i| {ip_address: i.ip_address, name: i.getnameinfo} }
end