Module: Utility::Computer

Included in:
Utility
Defined in:
lib/utility/computer.rb

Instance Method Summary collapse

Instance Method Details

#get_archObject



27
28
29
# File 'lib/utility/computer.rb', line 27

def get_arch
  1226.size * 8
end

#get_hostnameObject



19
20
21
# File 'lib/utility/computer.rb', line 19

def get_hostname
  Socket.gethostname
end

#get_ipObject



6
7
8
9
10
11
12
13
# File 'lib/utility/computer.rb', line 6

def get_ip
  ip = Socket.ip_address_list.detect do |intf|
    intf.ipv4? &&
    !intf.ipv4_loopback? &&
    !intf.ipv4_multicast?
  end
  ip.nil?? "IP address not found" : ip.ip_address
end

#get_macObject



15
16
17
# File 'lib/utility/computer.rb', line 15

def get_mac
  Mac.addr.list rescue Mac.address
end

#get_osObject



23
24
25
# File 'lib/utility/computer.rb', line 23

def get_os
  Gem::Platform.local.os
end