Sha256: a40cdb7044f4dac8c22770f65315b7aeda61f38012d54ca7a3ecb18e9e70625f

Contents?: true

Size: 292 Bytes

Versions: 2

Compression:

Stored size: 292 Bytes

Contents

require 'socket'

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
swiss_admin-0.7.0 lib/swiss_admin/network/network.rb
swiss_admin-0.6.1 lib/swiss_admin/network/network.rb